distro_tracker.test¶
Distro Tracker test infrastructure.
-
class
distro_tracker.test.
TempDirsMixin
[source]¶ Bases:
object
Diverts all distro-tracker path settings to make them point to temporary directories while testing.
-
DISTRO_TRACKER_PATH_SETTINGS
= {'DISTRO_TRACKER_CACHE_DIRECTORY': 'cache', 'DISTRO_TRACKER_KEYRING_DIRECTORY': 'keyring', 'DISTRO_TRACKER_LOG_DIRECTORY': 'logs', 'DISTRO_TRACKER_MAILDIR_DIRECTORY': 'maildir', 'DISTRO_TRACKER_TEMPLATE_DIRECTORY': 'templates', 'MEDIA_ROOT': 'media', 'STATIC_ROOT': 'static'}¶
-
-
class
distro_tracker.test.
TestCaseHelpersMixin
[source]¶ Bases:
object
Helpers method injected into distro_tracker’s
*TestCase
objects.-
get_test_data_path
(name)[source]¶ Returns an absolute path name of file within the tests-data subdirectory in the calling TestCase.
-
-
class
distro_tracker.test.
DatabaseMixin
[source]¶ Bases:
object
Database-related assertions injected into distro_tracker’s
*TestCase
objects.-
create_source_package
(**kwargs)[source]¶ Creates a source package and any related object requested through the keyword arguments. The following arguments are supported: - name - version - directory - dsc_file_name - maintainer (dict with ‘name’ and ‘email’) - uploaders (list of emails) - architectures (list of architectures) - binary_packages (list of package names) - repository (shorthand of a repository) - repositories (list of repositories’ shorthand) - data (dict used to generate associated PackageData)
If the shorthand of the requested repository is ‘default’, then its default field will be set to True.
- Returns
the created source package
- Return type
-
add_to_repository
(srcpkg, shorthand='default')[source]¶ Add a source package to a repository. Creates the repository if it doesn’t exist.
If the shorthand of the requested repository is ‘default’, then its default field will be set to True.
- Parameters
srcpkg (
SourcePackage
) – the source package to add to the repositoryshorthand (str) – the shorthand of the repository
- Returns
the repository entry that has been created
- Return type
-
remove_from_repository
(srcpkg, shorthand='default')[source]¶ Remove a source package from a repository.
- Parameters
srcpkg (
SourcePackage
) – the source package to add to the repositoryshorthand (str) – the shorthand of the repository
-
add_package_data
(pkgname, **kwargs)[source]¶ Creates PackageData objects associated to the package indicated in pkgname. Each named parameter results in PackageData instance with the key being the name of the parameter and the value being the value of the named parameter.
- Parameters
pkgname (str or
PackageName
) – the name of the package to which we want to associate data
-
-
class
distro_tracker.test.
SimpleTestCase
(methodName='runTest')[source]¶ Bases:
distro_tracker.test.TempDirsMixin
,distro_tracker.test.TestCaseHelpersMixin
,django.test.testcases.SimpleTestCase
-
class
distro_tracker.test.
TestCase
(methodName='runTest')[source]¶ Bases:
distro_tracker.test.TempDirsMixin
,distro_tracker.test.TestCaseHelpersMixin
,distro_tracker.test.DatabaseMixin
,django.test.testcases.TestCase
-
class
distro_tracker.test.
TransactionTestCase
(methodName='runTest')[source]¶ Bases:
distro_tracker.test.TempDirsMixin
,distro_tracker.test.TestCaseHelpersMixin
,distro_tracker.test.DatabaseMixin
,django.test.testcases.TransactionTestCase
-
class
distro_tracker.test.
LiveServerTestCase
(methodName='runTest')[source]¶ Bases:
distro_tracker.test.TempDirsMixin
,distro_tracker.test.TestCaseHelpersMixin
,distro_tracker.test.DatabaseMixin
,django.contrib.staticfiles.testing.StaticLiveServerTestCase
-
class
distro_tracker.test.
TemplateTestsMixin
[source]¶ Bases:
object
Helper methods to tests templates
-
class
distro_tracker.test.
UserAuthMixin
[source]¶ Bases:
object
Helpers methods to manage user authentication. One may define additional USERS before call self.setup_users() in self.setUp()
-
USERS
= {'john': {}}¶
-
setup_users
(login=False)[source]¶ Creates users defined in self.USERS and use the ‘login’ parameter as follows: * If False: no user login * If True: login with the only user defined * If a particular username: login with the user who owns the username
-