pulp_smash.tests.rpm.api_v2.test_unassociate

Location: Pulp SmashAPI Documentationpulp_smash.tests.rpm.api_v2.test_unassociate

Test Unassociating Content Units from a Repository for RPM.

This module assumes that the tests in pulp_smash.tests.platform.api_v2.test_repository and pulp_smash.tests.rpm.api_v2.test_sync_publish hold true.

class pulp_smash.tests.rpm.api_v2.test_unassociate.RemoveUnitsTestCase(methodName='runTest')

Remove units of various types from a synced RPM repository.

At a high level, this test case does the following:

  1. Create and sync an RPM repository.
  2. For each of several different types of content, remove a content unit of that type from the repository.
do_remove_unit(type_id)

Remove a content unit from the repository.

Do the following:

  1. Note the repository’s last_unit_removed field.
  2. Sleep for at least one second.
  3. Remove a unit of type type_id from the repository.
  4. Note the repository’s last_unit_removed field.

When the first unit is removed, assert that last_unit_removed changes from null to a non-null value. When each subsequent unit is removed, assert that last_unit_removed increments.

get_repo_last_unit_removed()

Get the repository’s last_unit_removed attribute.

classmethod setUpClass()

Create and sync a repository.

classmethod tearDownClass()

Remove the created repository and any orphans.

test_01_remove_units()

Remove several types of content units from the repository.

Each removal is wrapped in a subTest. See do_remove_unit().

test_02_remaining_units()

Assert the correct units are still in the repository.

The repository should have all the units that were originally synced into the repository, minus those that have been removed.

test_03_last_unit_removed()

Assert that last_unit_removed timestamp was not updated.

If disassociate_units is called and no units are removed, last_unit_removed should not update.

Do the following:

  1. Note the repository’s last_unit_removed field.
  2. Sleep for at least one second.
  3. Attempt to remove a non defined unit_id_name .
  4. Note the repository’s last_unit_removed field.
class pulp_smash.tests.rpm.api_v2.test_unassociate.RepublishTestCase(methodName='runTest')

Repeatedly publish a repository, with different content each time.

Specifically, do the following:

  1. Create a repository.
  2. Add a content unit to the repository. Publish the repository.
  3. Unassociate the content unit and repository. Publish the repository.

Verify that:

  • The last_unit_added, last_unit_removed and last_publish timestamps are correct.
  • The content unit in question is only available when associated with the repository.
get_repo()

Get detailed information about the repository.

classmethod setUpClass()

Create a repository.

classmethod tearDownClass()

Remove the created repository and any orphans.

test_01_add_unit()

Add a content unit to the repository. Publish the repository.

test_02_find_unit()

Search for the content unit. Assert it is available.

test_03_unassociate_unit()

Unassociate the unit from the repository. Publish the repository.

test_04_find_unit()

Search for the content unit. Assert it isn’t available.

class pulp_smash.tests.rpm.api_v2.test_unassociate.SelectiveAssociateTestCase(methodName='runTest')

Ensure Pulp only associate needed content.

Test steps:

  1. Create and sync an RPM repository.
  2. Unassociate some RPMs from the repository created on the previous step.
  3. Sync the repository again and check if only the missing units were associated.

See Pulp #2457

test_all()

Check if Pulp only associate missing repo content.

pulp_smash.tests.rpm.api_v2.test_unassociate.setUpModule()

Maybe skip this module of tests.