コード例 #1
0
 def setUpClass(cls):
     """Add content to Pulp."""
     cls.cfg = config.get_config()
     cls.client = api.Client(cls.cfg)
     # Populate Pulp to create content units.
     populate_pulp(cls.cfg, url=FILE_LARGE_FIXTURE_MANIFEST_URL)
     cls.content = sample(cls.client.get(FILE_CONTENT_PATH), 10)
コード例 #2
0
 def setUpClass(cls):
     """Create class-wide variables."""
     cls.cfg = config.get_config()
     delete_orphans(cls.cfg)
     populate_pulp(cls.cfg, url=FILE_LARGE_FIXTURE_MANIFEST_URL)
     cls.client = api.Client(cls.cfg, api.page_handler)
     cls.content = cls.client.get(FILE_CONTENT_PATH)
コード例 #3
0
ファイル: test_pagination.py プロジェクト: glbyers/pulp
    def test_content(self):
        """Test pagination for repository versions."""
        # Add content to Pulp, create a repo, and add content to repo. We
        # sample 21 contents, because with page_size set to 10, this produces 3
        # pages, where the three three pages have unique combinations of values
        # for the "previous" and "next" links.
        populate_pulp(self.cfg, url=FILE_MANY_FIXTURE_MANIFEST_URL)
        sample_size = min(FILE_MANY_FIXTURE_COUNT, 21)
        contents = sample(self.client.get(FILE_CONTENT_PATH), sample_size)
        repo = self.client.post(REPO_PATH, gen_repo())
        self.addCleanup(self.client.delete, repo['_href'])

        def add_content():
            """Repeatedly pop an item from ``contents``, and add to repo."""
            while True:
                try:
                    content = contents.pop()
                    self.client.post(
                        repo['_versions_href'],
                        {'add_content_units': [content['_href']]}
                    )
                except IndexError:
                    break

        threads = tuple(Thread(target=add_content) for _ in range(8))
        for thread in threads:
            thread.start()
        for thread in threads:
            thread.join()

        # Verify pagination works for getting repo versions.
        repo = self.client.get(repo['_href'])
        repo_versions = get_versions(repo, {'page_size': 10})
        self.assertEqual(len(repo_versions), sample_size, repo_versions)
コード例 #4
0
ファイル: test_repo_versions.py プロジェクト: asmacdo/pulp
 def setUpClass(cls):
     """Create class-wide variables."""
     cls.cfg = config.get_config()
     delete_orphans(cls.cfg)
     populate_pulp(cls.cfg, url=FILE_LARGE_FIXTURE_MANIFEST_URL)
     cls.client = api.Client(cls.cfg, api.page_handler)
     cls.content = cls.client.get(FILE_CONTENT_PATH)
コード例 #5
0
    def setUpClass(cls):
        """Create class-wide variables.

        Populate Pulp with artifacts to show how the filter is related to
        repository version.
        """
        cls.cfg = config.get_config()
        populate_pulp(cls.cfg, url=FILE_MANY_FIXTURE_MANIFEST_URL)
        cls.client = api.Client(cls.cfg)
コード例 #6
0
 def setUpClass(cls):
     """Add content to Pulp."""
     cls.cfg = config.get_config()
     cls.client = api.Client(cls.cfg, api.json_handler)
     populate_pulp(cls.cfg, url=FILE_LARGE_FIXTURE_MANIFEST_URL)
     # We need at least three content units. Choosing a relatively low
     # number is useful, to limit how many repo versions are created, and
     # thus how long the test takes.
     cls.content = sample(cls.client.get(FILE_CONTENT_PATH)['results'], 10)
コード例 #7
0
ファイル: test_repo_versions.py プロジェクト: asmacdo/pulp
 def setUpClass(cls):
     """Add content to Pulp."""
     cls.cfg = config.get_config()
     cls.client = api.Client(cls.cfg, api.json_handler)
     populate_pulp(cls.cfg, url=FILE_LARGE_FIXTURE_MANIFEST_URL)
     # We need at least three content units. Choosing a relatively low
     # number is useful, to limit how many repo versions are created, and
     # thus how long the test takes.
     cls.content = sample(cls.client.get(FILE_CONTENT_PATH)['results'], 10)
コード例 #8
0
    def setUpClass(cls):
        """Create class-wide variables.

        Add content to Pulp.
        """
        cls.cfg = config.get_config()
        cls.client = api.Client(cls.cfg, api.json_handler)

        populate_pulp(cls.cfg)
        cls.contents = cls.client.get(FILE_CONTENT_PATH)["results"]
コード例 #9
0
    def setUpClass(cls):
        """Create class-wide variables.

        Add content to Pulp.
        """
        cls.cfg = config.get_config()
        delete_orphans(cls.cfg)
        cls.client = api.Client(cls.cfg, api.json_handler)
        populate_pulp(cls.cfg)
        cls.contents = cls.client.get(FILE_CONTENT_PATH)['results'][:2]
コード例 #10
0
    def setUp(self):
        """Add content to Pulp."""
        self.cfg = config.get_config()
        self.client = api.Client(self.cfg, api.json_handler)
        self.core_client = CoreApiClient(configuration=self.cfg.get_bindings_config())
        self.file_client = gen_file_client()

        self.content_api = ContentFilesApi(self.file_client)
        self.repo_api = RepositoriesFileApi(self.file_client)
        self.version_api = RepositoriesFileVersionsApi(self.file_client)
        self.distro_api = DistributionsFileApi(self.file_client)
        self.publication_api = PublicationsFileApi(self.file_client)

        delete_orphans()
        populate_pulp(self.cfg, url=FILE_LARGE_FIXTURE_MANIFEST_URL)
        self.content = sample(self.content_api.list().results, 3)
        self.publications = []
コード例 #11
0
ファイル: test_pagination.py プロジェクト: wibbit/pulpcore
    def test_file_content(self):
        """Test pagination for repository versions."""
        # Add content to Pulp, create a repo, and add content to repo. We
        # sample 21 contents, because with page_size set to 10, this produces 3
        # pages, where the three three pages have unique combinations of values
        # for the "previous" and "next" links.
        populate_pulp(self.cfg, url=FILE_MANY_FIXTURE_MANIFEST_URL)
        sample_size = min(FILE_MANY_FIXTURE_COUNT, 21)
        contents = sample(self.client.get(FILE_CONTENT_PATH), sample_size)
        repo = self.client.post(FILE_REPO_PATH, gen_repo())
        self.addCleanup(self.client.delete, repo["pulp_href"])

        for content in contents:
            modify_repo(self.cfg, repo, add_units=[content])

        # Verify pagination works for getting repo versions.
        repo = self.client.get(repo["pulp_href"])
        repo_versions = get_versions(repo, {"page_size": 10})
        self.assertEqual(len(repo_versions), sample_size + 1, repo_versions)
コード例 #12
0
ファイル: test_pagination.py プロジェクト: asmacdo/pulp
    def test_content(self):
        """Test pagination for repository versions."""
        # Add content to Pulp, create a repo, and add content to repo. We
        # sample 21 contents, because with page_size set to 10, this produces 3
        # pages, where the three three pages have unique combinations of values
        # for the "previous" and "next" links.
        populate_pulp(self.cfg, url=FILE_MANY_FIXTURE_MANIFEST_URL)
        sample_size = min(FILE_MANY_FIXTURE_COUNT, 21)
        contents = sample(self.client.get(FILE_CONTENT_PATH), sample_size)
        repo = self.client.post(REPO_PATH, gen_repo())
        self.addCleanup(self.client.delete, repo['_href'])

        for content in contents:
            self.client.post(
                repo['_versions_href'],
                {'add_content_units': [content['_href']]}
            )

        # Verify pagination works for getting repo versions.
        repo = self.client.get(repo['_href'])
        repo_versions = get_versions(repo, {'page_size': 10})
        self.assertEqual(len(repo_versions), sample_size, repo_versions)