Location: Pulp SmashAPI Documentationtests.test_utils

Unit tests for pulp_smash.utils.

class tests.test_utils.BaseAPITestCase(methodName='runTest')

Test pulp_smash.utils.BaseAPITestCase.

classmethod setUpClass()

Define a child class. Call setup and teardown methods on it.

We define a child class in order to avoid altering pulp_smash.utils.BaseAPITestCase. Calling class methods on it would do so.


Assert method setUpClass creates correct class attributes.

Verify that the method creates attributes named cfg and resources.


Call method tearDownClass, and assert it deletes each resource.

pulp_smash.api.Client.delete() should be called once for each resource listed in resources, and once for pulp_smash.constants.ORPHANS_PATH.

class tests.test_utils.GetBrokerTestCase(methodName='runTest')

Test pulp_smash.utils.get_broker().


Fail to generate a broker service management object.

Assert that pulp_smash.exceptions.NoKnownBrokerError is raised if the function cannot find a broker.


Successfully generate a broker service management object.

Assert that:

  • get_broker(…) returns a string.
  • The server_config argument is passed to the service object.
  • The “qpidd” broker is the preferred broker.
class tests.test_utils.GetSha256ChecksumTestCase(methodName='runTest')

Test pulp_smash.utils.get_sha256_checksum().


Call the function three times, with two URLs.

Call the function with the first URL, the second URL and the first URL again. Verify that:

  • No download is attempted during the third call.
  • The first and second calls return different checksums.
  • The first and third calls return identical checksums.
class tests.test_utils.GetUnitTypeIdsTestCase(methodName='runTest')

Test pulp_smash.utils.skip_if_type_is_unsupported().


Assert each unit type ID in the server response is returned.

class tests.test_utils.IsRootTestCase(methodName='runTest')

Test pulp_smash.utils.is_root.


Assert the method returns False when non-root.


Assert the method returns True when root.

class tests.test_utils.PulpAdminLoginTestCase(methodName='runTest')

Test pulp_smash.utils.pulp_admin_login().


Assert the function executes cli.Client.run.

class tests.test_utils.SearchUnitsTestCase(methodName='runTest')

Test pulp_smash.utils.search_units().


Verify that default parameters are correctly set.

class tests.test_utils.SkipIfTypeIsUnsupportedTestCase(methodName='runTest')

Test pulp_smash.utils.skip_if_type_is_unsupported().


Generate a random unit type ID.


Assert nothing happens if the given unit type is supported.

Also assert pulp_smash.config.get_config() is not called, as we provide a pulp_smash.config.PulpSmashConfig argument.


Assert SkipTest is raised if the given unit type is unsupported.

Also assert pulp_smash.config.get_config() is called, as we do not provide a pulp_smash.config.PulpSmashConfig argument.

class tests.test_utils.SyncRepoTestCase(methodName='runTest')

Test pulp_smash.utils.sync_repo().


Assert the function makes an HTTP POST request.

class tests.test_utils.UUID4TestCase(methodName='runTest')

Test pulp_smash.utils.uuid4().


Assert the method returns a unicode string.

class tests.test_utils.UploadImportErratumTestCase(methodName='runTest')

Test pulp_smash.utils.upload_import_unit().


Assert the function makes an HTTP POST request.

class tests.test_utils.UploadImportUnitTestCase(methodName='runTest')

Test pulp_smash.utils.upload_import_unit().


Assert the function makes an HTTP POST request.