pulp_2_tests.tests.python.api_v2.test_sync_publish

Location: Pulp 2 TestsTestspulp_2_tests.tests.python.api_v2.test_sync_publish

Test the sync and publish API endpoints for Python repositories.

class pulp_2_tests.tests.python.api_v2.test_sync_publish.BaseTestCase(methodName='runTest')

Bases: unittest.case.TestCase

A base class for the test cases in this module.

Test cases derived from this class (should) do the following:

  1. Create and populate a Python repository. The procedure for populating the repository varies in each child class.
  2. Create a second Python repository, and sync it from the first.

In each step, the verify_* methods are used if appropriate.

classmethod setUpClass()

Create class-wide variables.

classmethod tearDownClass()

Delete fixtures and orphans.

test_01_first_repo()

Create, populate and publish a Python repository.

Subclasses must override this method.

test_02_second_repo()

Create a second Python repository, and sync it from the first.

See:

Note that, for Pulp #140 to be fully tested, an additional test case should be created wherein one Pulp application syncs from another completely independent Pulp application.

verify_package_types(cfg, repo)

Assert sdist and bdist_wheel shelf-reader packages were synced.

This test targets Pulp #1883.

verify_sync(cfg, call_report)

Verify the call to sync a Python repository succeeded.

Assert that:

  • The call report has an HTTP 202 status code.
  • None of the tasks spawned by the “sync” request contain errors.
class pulp_2_tests.tests.python.api_v2.test_sync_publish.SyncTestCase(methodName='runTest')

Bases: pulp_2_tests.tests.python.api_v2.test_sync_publish.BaseTestCase

Test whether content can be synced into a Python repository.

test_01_first_repo()

Create, sync content into and publish a Python repository.

See:

class pulp_2_tests.tests.python.api_v2.test_sync_publish.UploadTestCase(methodName='runTest')

Bases: pulp_2_tests.tests.python.api_v2.test_sync_publish.BaseTestCase

Test whether content can be uploaded to a Python repository.

classmethod setUpClass()

Skip this test if FIPS is supported and enabled.

See Pulp #3895.

test_01_first_repo()

Create, upload content into and publish a Python repository.

See:

pulp_2_tests.tests.python.api_v2.test_sync_publish.get_details(cfg, repo)

Return detailed information about a Python repository.

pulp_2_tests.tests.python.api_v2.test_sync_publish.get_repo_path(cfg, repo)

Return the root path to a published Python repository.

pulp_2_tests.tests.python.api_v2.test_sync_publish.skip_if(func, var_name, result, *, exc=<class 'unittest.case.SkipTest'>)

Optionally skip a test method, based on a condition.

This decorator checks to see if func(getattr(self, var_name)) equals result. If so, an exception of type exc is raised. Otherwise, nothing happens, and the decorated test method continues as normal. Here’s an example of how to use this method:

>>> import unittest
>>> from pulp_smash.selectors import skip_if
>>> class MyTestCase(unittest.TestCase):
...
...     @classmethod
...     def setUpClass(cls):
...         cls.my_var = False
...
...     @skip_if(bool, 'my_var', False, unittest.SkipTest)
...     def test_01_skips(self):
...         pass
...
...     def test_02_runs(self):
...         type(self).my_var = True
...
...     @skip_if(bool, 'my_var', False, unittest.SkipTest)
...     def test_03_runs(self):
...         pass

If the same exception should be passed each time this method is called, consider using functools.partial:

>>> from functools import partial
>>> from unittest import SkipTest
>>> from pulp_smash.selectors import skip_if
>>> unittest_skip_if = partial(skip_if, exc=SkipTest)
Parameters:
  • var_name – A valid variable name.
  • result – A value to compare to func(getattr(self, var_name)).
  • exc – A class to instantiate and raise as an exception. Its constructor must accept one string argument.