def setUpClass(cls):
     """Create a Docker repository."""
     super(DuplicateUploadsTestCase, cls).setUpClass()
     unit = utils.http_get(DOCKER_IMAGE_URL)
     unit_type_id = 'docker_image'
     client = api.Client(cls.cfg, api.json_handler)
     repo_href = client.post(REPOSITORY_PATH, gen_repo())['_href']
     cls.resources.add(repo_href)
     cls.upload_import_unit_args = (cls.cfg, unit, unit_type_id, repo_href)
 def setUpClass(cls):
     """Create a Docker repository."""
     super(DuplicateUploadsTestCase, cls).setUpClass()
     unit = utils.http_get(DOCKER_IMAGE_URL)
     unit_type_id = 'docker_image'
     client = api.Client(cls.cfg, api.json_handler)
     repo_href = client.post(REPOSITORY_PATH, gen_repo())['_href']
     cls.resources.add(repo_href)
     cls.upload_import_unit_args = (cls.cfg, unit, unit_type_id, repo_href)
Ejemplo n.º 3
0
    def setUpClass(cls):
        """Create a docker repository with an importer.

        The importer has no ``upstream_name`` set. it must be passed via
        ``override_config`` when a sync is requested.
        """
        super(UpstreamNameV2TestCase, cls).setUpClass()
        body = gen_repo()
        body['importer_config'] = {'feed': DOCKER_V2_FEED_URL}
        cls.repo_href = (api.Client(cls.cfg).post(REPOSITORY_PATH,
                                                  body).json()['_href'])
        cls.resources.add(cls.repo_href)
Ejemplo n.º 4
0
    def setUpClass(cls):
        """Create a docker repository with an importer.

        The importer has no ``upstream_name`` set. it must be passed via
        ``override_config`` when a sync is requested.
        """
        super(UpstreamNameV2TestCase, cls).setUpClass()
        body = gen_repo()
        body['importer_config'] = {'feed': DOCKER_V2_FEED_URL}
        cls.repo_href = (
            api.Client(cls.cfg).post(REPOSITORY_PATH, body).json()['_href']
        )
        cls.resources.add(cls.repo_href)
Ejemplo n.º 5
0
    def setUpClass(cls):
        """Create a docker repo with a distributor, and update the distributor.

        Do the following:

        1. Create a docker repository and add a distributor.
        2. Update the distributor. Use the distributor's href in the request.
        3. Update the distributor. Use the repository's href in the request,
           and ensure the distributor is updated by packing certain data in the
           request body.
        """
        super(UpdateTestCase, cls).setUpClass()
        cls.sent_ids = tuple(('test/' + utils.uuid4() for _ in range(2)))
        cls.responses = {}

        # Create a repository and a distributor
        client = api.Client(cls.cfg)
        repo = client.post(REPOSITORY_PATH, gen_repo()).json()
        cls.resources.add(repo['_href'])
        cls.responses['add distributor'] = client.post(
            urljoin(repo['_href'], 'distributors/'),
            _gen_distributor(),
        )
        distributor = cls.responses['add distributor'].json()

        # Update the distributor
        cls.responses['first update'] = client.put(
            distributor['_href'],
            {'distributor_config': {
                'repo_registry_id': cls.sent_ids[0]
            }},
        )
        cls.responses['first read'] = client.get(distributor['_href'])

        # Update the distributor again, from repo this time
        cls.responses['second update'] = client.put(
            repo['_href'],
            {
                'distributor_configs': {
                    distributor['id']: {
                        'repo_registry_id': cls.sent_ids[1],
                    }
                }
            },
        )
        cls.responses['second read'] = client.get(distributor['_href'])
Ejemplo n.º 6
0
    def setUpClass(cls):
        """Create a docker repo with a distributor, and update the distributor.

        Do the following:

        1. Create a docker repository and add a distributor.
        2. Update the distributor. Use the distributor's href in the request.
        3. Update the distributor. Use the repository's href in the request,
           and ensure the distributor is updated by packing certain data in the
           request body.
        """
        super(UpdateTestCase, cls).setUpClass()
        cls.sent_ids = tuple(('test/' + utils.uuid4() for _ in range(2)))
        cls.responses = {}

        # Create a repository and a distributor
        client = api.Client(cls.cfg)
        repo = client.post(REPOSITORY_PATH, gen_repo()).json()
        cls.resources.add(repo['_href'])
        cls.responses['add distributor'] = client.post(
            urljoin(repo['_href'], 'distributors/'),
            _gen_distributor(),
        )
        distributor = cls.responses['add distributor'].json()

        # Update the distributor
        cls.responses['first update'] = client.put(
            distributor['_href'],
            {'distributor_config': {'repo_registry_id': cls.sent_ids[0]}},
        )
        cls.responses['first read'] = client.get(distributor['_href'])

        # Update the distributor again, from repo this time
        cls.responses['second update'] = client.put(
            repo['_href'],
            {'distributor_configs': {distributor['id']: {
                'repo_registry_id': cls.sent_ids[1],
            }}},
        )
        cls.responses['second read'] = client.get(distributor['_href'])
Ejemplo n.º 7
0
 def create_body():
     """Return a dict for creating a repository."""
     return gen_repo()
Ejemplo n.º 8
0
 def create_body():
     """Return a dict for creating a repository."""
     return gen_repo()