pulp_2_tests.tests.rpm.api_v2.test_export

Location: Pulp 2 TestsTestspulp_2_tests.tests.rpm.api_v2.test_export

Test the API’s Export Distributors feature.

class pulp_2_tests.tests.rpm.api_v2.test_export.BaseExportChecksumTypeTestCase(*args, **kwargs)

Bases: pulp_2_tests.tests.rpm.api_v2.test_export.ExportDirMixin, pulp_smash.pulp2.utils.BaseAPITestCase

Base class for repo and repo group export with checksum type tests.

get_export_entity()

Provide the export entity.

The entity can be either a repository or a repository group.

get_export_entity_type()

Provide the export entity type.

Return repos for repository and repo_group for repository group.

get_repomd_iso_publish_path(export_dir, distributor)

Provide the repomd.xml publish path within an exported ISO.

Repository and repository group exports have a different path to repomd.xml file within the exported ISO.

get_repomd_publish_path(export_dir, distributor)

Provide the repomd.xml publish path.

Repository and repository group exports have a different path to repomd.xml file.

classmethod setUpClass()

Create and sync a repository.

Also skips the test if Pulp version less than 2.9.

Children of this base class must provide a distributors attribute with the list of distributors to export a repository or repository group.

test_publish_to_dir_checksum_type()

Publish to a directory choosing the checksum type.

test_publish_to_web_checksum_type()

Publish to web choosing the checksum type.

class pulp_2_tests.tests.rpm.api_v2.test_export.ExportChecksumTypeTestCase(*args, **kwargs)

Bases: pulp_2_tests.tests.rpm.api_v2.test_export.BaseExportChecksumTypeTestCase

Publish a repository choosing the distributor checksum type.

get_export_entity()

Provide the export entity.

get_export_entity_type()

Provide the export entity type.

get_repomd_iso_publish_path(export_dir, distributor)

Provide the repomd.xml publish path within an exported ISO.

get_repomd_publish_path(export_dir, distributor)

Provide the repomd.xml publish path.

classmethod setUpClass()

Create some distributors.

Each distributor is configured with a valid checksum type.

class pulp_2_tests.tests.rpm.api_v2.test_export.ExportDirMixin

Bases: pulp_2_tests.tests.rpm.api_v2.utils.DisableSELinuxMixin

Mixin with repo export to dir utilities.

A mixin with methods for managing an export directory on a Pulp server. This mixin is designed to support the following work flow:

  1. Create a directory. (See create_export_dir().)
  2. Export a repository to the directory.
  3. Make the directory readable. (See change_export_dir_owner().)
  4. Inspect the contents of the directory.

publish_to_dir() conveniently executes steps 1–3. Consider using the other methods only if more granularity is needed.

A class attribute named cfg must be present. It should be a pulp_smash.config.PulpSmashConfig`.

change_export_dir_owner(export_dir)

Change the owner to the running Pulp Smash user.

Update the remote path dir owner to the user running Pulp Smash.

create_export_dir()

Create a directory, and ensure Pulp can export to it.

Create a directory, and set its owner and group to apache. If Pulp issue 616 affects the current Pulp system, disable SELinux, and schedule a clean-up command that re-enables SELinux.

Warning

Only call this method from a unittest test* method. If called from elsewhere, SELinux may be left disabled.

Returns:The path to the created directory, as a string.
publish_to_dir(entity_href, distributor_id)

Create an export directory, publish to it, and change its owner.

For details, see ExportDirMixin.

Parameters:
  • entity_href – The path to an entity such as a repository or a repository group.
  • distributor_id – The ID of the distributor to use when exporting.
Returns:

The path to the export directory.

class pulp_2_tests.tests.rpm.api_v2.test_export.ExportDistributorTestCase(*args, **kwargs)

Bases: pulp_2_tests.tests.rpm.api_v2.test_export.ExportDirMixin, pulp_smash.pulp2.utils.BaseAPITestCase

Establish we can publish a repository using an export distributor.

setUp()

Optionally create an export distributor.

Create an export distributor only if one is not already present. (See setUpClass().)

classmethod setUpClass()

Create and sync a repository. Optionally create a distributor.

Skip creating the distributor if we are testing Pulp 2.9 and it is affected by Pulp #1928.

test_publish_to_dir()

Publish the repository to a directory on the Pulp server.

gerify that pulp_2_tests.constants.RPM is present and has a correct checksum.

This test is skipped if selinux is installed and enabled on the target system an Pulp issue 616 is open.

test_publish_to_web()

Publish the repository to the web, and fetch the ISO file.

The ISO file should be available over both HTTP and HTTPS. Fetch it from both locations, and assert that the fetch was successful.

class pulp_2_tests.tests.rpm.api_v2.test_export.RepoGroupExportChecksumTypeTestCase(*args, **kwargs)

Bases: pulp_2_tests.tests.rpm.api_v2.test_export.BaseExportChecksumTypeTestCase

Publish a repository group choosing the distributor checksum type.

get_export_entity()

Provide the export entity.

get_export_entity_type()

Provide the export entity type.

get_repomd_iso_publish_path(export_dir, distributor)

Provide the repomd.xml publish path within an exported ISO.

get_repomd_publish_path(export_dir, distributor)

Provide the repomd.xml publish path.

classmethod setUpClass()

Create required entities for publishing a repository group.

Do the following:

  1. Create a repository group and add the repository created by super call.
  2. Creates some distributors. Each distributor is configured with a valid checksum type.
pulp_2_tests.tests.rpm.api_v2.test_export.setUpModule()

Possibly skip the tests in this module.

Skip tests if Pulp #2277 affects us.