djblets.extensions.testing.testcases¶
Mixins for test cases that need to test enabled extensions.
-
class
ExtensionTestCaseMixin
[source]¶ Bases:
object
Unit tests mixin for more easily testing extensions.
This will do the hard work of creating the fake registration information needed for an extension and to instantiate an instance for testing.
Subclasses need to define
extension_class
and may want to implementget_extension_manager()
(by default, the first registered extension manager will be used).Projects may want to provide their own subclass for their extensions to use that implements
get_extension_manager()
, so extensions won’t have to.-
extension_mgr
¶ The extension manager owning the extension. Tests can use this to manually enable/disable the extension, if needed.
Type: djblets.extensions.manager.ExtensionManager
-
extension
¶ The extension instance being tested.
Type: djblets.extensions.extension.Extension
-
extension_package_name
= u'TestPackage'[source]¶ Optional package name to use for the extension information.
-
get_extension_manager
()[source]¶ Return the extension manager used for the tests.
Subclasses may want to override this to pick a specific extension manager, if the project uses more than one. The default behavior is to return the first registered extension manager.
Returns: The extension manager used for tests. Return type: djblets.extensions.manager.ExtensionManager
-