Exemplo n.º 1
0
    def test_02_second_repo(self):
        """Create a second Python repository, and sync it from the first.

        See:

        * `Pulp #140 <https://pulp.plan.io/issues/140>`_
        * `Pulp Smash #493 <https://github.com/PulpQE/pulp-smash/issues/493>`_

        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.
        """
        if (self.cfg.pulp_version < Version('2.13')
                or selectors.bug_is_untestable(140, self.cfg.pulp_version)):
            self.skipTest('https://pulp.plan.io/issues/140')
        client = api.Client(self.cfg, api.json_handler)
        body = gen_repo()
        body['importer_config'] = {
            'feed': get_repo_path(self.cfg, self.repos[0]),
            'package_names': 'shelf-reader',
        }
        repo = client.post(REPOSITORY_PATH, body)
        self.repos.append(repo)
        call_report = utils.sync_repo(self.cfg, repo)
        with self.subTest(comment='verify the sync succeeded'):
            self.verify_sync(self.cfg, call_report)
        with self.subTest(comment='verify content units are present'):
            self.verify_package_types(self.cfg, repo)
Exemplo n.º 2
0
    def test_01_first_repo(self):
        """Create, sync content into and publish a Python repository.

        See:

        * `Pulp #135 <https://pulp.plan.io/issues/135>`_
        * `Pulp Smash #494 <https://github.com/PulpQE/pulp-smash/issues/494>`_
        """
        if (self.cfg.pulp_version < Version('2.13')
                or selectors.bug_is_untestable(135, self.cfg.pulp_version)):
            self.skipTest('https://pulp.plan.io/issues/135')
        client = api.Client(self.cfg, api.json_handler)
        body = gen_repo()
        body['importer_config'] = {
            'feed': constants.PYTHON_PYPI_FEED_URL,
            'package_names': 'shelf-reader',
        }
        body['distributors'] = [gen_distributor()]
        repo = client.post(REPOSITORY_PATH, body)
        self.repos.append(repo)
        call_report = utils.sync_repo(self.cfg, repo)
        with self.subTest(comment='verify the sync succeeded'):
            self.verify_sync(self.cfg, call_report)
        with self.subTest(comment='verify content units are present'):
            self.verify_package_types(self.cfg, repo)
        repo = get_details(self.cfg, repo)
        utils.publish_repo(self.cfg, repo)
 def setUpClass(cls):
     """Create a Python repo. Upload a Python package into it twice."""
     super(DuplicateUploadsTestCase, cls).setUpClass()
     if (cls.cfg.pulp_version >= Version('2.11')
             and selectors.bug_is_untestable(2334, cls.cfg.pulp_version)):
         raise unittest.SkipTest('https://pulp.plan.io/issues/2334')
     unit = utils.http_get(PYTHON_EGG_URL)
     import_params = {'unit_type_id': 'python_package'}
     repo = api.Client(cls.cfg).post(REPOSITORY_PATH, gen_repo()).json()
     cls.upload_import_unit_args = (cls.cfg, unit, import_params, repo)
     cls.resources.add(repo['_href'])
Exemplo n.º 4
0
    def test_01_first_repo(self):
        """Create, upload content into and publish a Python repository.

        See:

        * `Pulp #136 <https://pulp.plan.io/issues/136>`_
        * `Pulp #2334 <https://pulp.plan.io/issues/2334>`_
        * `Pulp Smash #492 <https://github.com/PulpQE/pulp-smash/issues/492>`_
        """
        if (self.cfg.pulp_version < Version('2.13')
                or selectors.bug_is_untestable(136, self.cfg.pulp_version)):
            self.skipTest('https://pulp.plan.io/issues/136')
        client = api.Client(self.cfg, api.json_handler)
        body = gen_repo()
        body['distributors'] = [gen_distributor()]
        repo = client.post(REPOSITORY_PATH, body)
        self.repos.append(repo)

        # A for loop is easier, but it produces hard-to-debug test failures.
        def upload_import_unit(url):
            """Upload and import the unit at ``url`` to ``repo``."""
            unit = utils.http_get(url)
            utils.upload_import_unit(
                self.cfg, unit, {
                    'unit_key': {
                        'filename': basename(urlparse(url).path)
                    },
                    'unit_type_id': 'python_package',
                }, repo)

        upload_import_unit(constants.PYTHON_EGG_URL)
        upload_import_unit(constants.PYTHON_WHEEL_URL)
        with self.subTest(comment='verify content units are present'):
            self.verify_package_types(self.cfg, repo)
        repo = get_details(self.cfg, repo)
        utils.publish_repo(self.cfg, repo)
Exemplo n.º 5
0
 def create_body():
     """Return a dict for creating a repository."""
     return gen_repo()