tests.test_utils

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.

test_set_up_class()

Assert method setUpClass creates correct class attributes.

Verify that the method creates attributes named cfg and resources.

test_tear_down_class()

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().

test_failure()

Fail to generate a broker service management object.

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

test_success()

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().

test_all()

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().

test_ids_are_returned()

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

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

Test pulp_smash.utils.is_root.

test_false()

Assert the method returns False when non-root.

test_true()

Assert the method returns True when root.

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

Test pulp_smash.utils.pulp_admin_login().

test_run()

Assert the function executes cli.Client.run.

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

Test pulp_smash.utils.search_units().

test_defaults()

Verify that default parameters are correctly set.

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

Test pulp_smash.utils.skip_if_type_is_unsupported().

setUp()

Generate a random unit type ID.

test_type_is_supported()

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.

test_type_is_unsupported()

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().

test_post()

Assert the function makes an HTTP POST request.

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

Test pulp_smash.utils.uuid4().

test_type()

Assert the method returns a unicode string.

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

Test pulp_smash.utils.upload_import_unit().

test_post()

Assert the function makes an HTTP POST request.

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

Test pulp_smash.utils.upload_import_unit().

test_post()

Assert the function makes an HTTP POST request.