コード例 #1
0
class TestTagUpdateCommand(unittest.TestCase):
    def setUp(self):
        self.context = mock.MagicMock()
        self.context.config = test_config
        self.command = TagUpdateCommand(self.context)

    def test_determine_id(self):
        ret = self.command.determine_type_id('/a/b/c')
        self.assertEqual(ret, constants.TAG_TYPE_ID)

    def test_generate_unit_key(self):
        kwargs = {TAG_NAME_OPTION.keyword: data.tag_name,
                  std_options.OPTION_REPO_ID.keyword: data.repo_id}
        unit_key = self.command.generate_unit_key(data.busybox_tar_path, **kwargs)
        self.assertEqual(unit_key, {'name': data.tag_name, 'repo_id': data.repo_id})

    def test_generate_metadata(self):
        kwargs = {TAG_NAME_OPTION.keyword: data.tag_name,
                  MANIFEST_DIGEST_OPTION.keyword: data.manifest_digest}
        metadata = self.command.generate_metadata(data.busybox_tar_path, **kwargs)
        self.assertEqual(metadata, {'name': data.tag_name, 'digest': data.manifest_digest})

    def test_generate_override_config(self):
        ret = self.command.generate_override_config()
        self.assertEqual(ret, {})
コード例 #2
0
class TestTagUpdateCommand(unittest.TestCase):
    def setUp(self):
        self.context = mock.MagicMock()
        self.context.config = test_config
        self.command = TagUpdateCommand(self.context)

    def test_determine_id(self):
        ret = self.command.determine_type_id('/a/b/c')
        self.assertEqual(ret, constants.TAG_TYPE_ID)

    def test_generate_unit_key(self):
        kwargs = {
            TAG_NAME_OPTION.keyword: data.tag_name,
            std_options.OPTION_REPO_ID.keyword: data.repo_id
        }
        unit_key = self.command.generate_unit_key(data.busybox_tar_path,
                                                  **kwargs)
        self.assertEqual(unit_key, {
            'name': data.tag_name,
            'repo_id': data.repo_id
        })

    def test_generate_metadata(self):
        kwargs = {
            TAG_NAME_OPTION.keyword: data.tag_name,
            DIGEST_OPTION.keyword: data.manifest_digest
        }
        metadata = self.command.generate_metadata(data.busybox_tar_path,
                                                  **kwargs)
        self.assertEqual(metadata, {
            'name': data.tag_name,
            'digest': data.manifest_digest
        })

    def test_generate_override_config(self):
        ret = self.command.generate_override_config()
        self.assertEqual(ret, {})
コード例 #3
0
def add_repo_section(context, parent_section):
    """
    add a repo section to the docker section

    :type  context: pulp.client.extensions.core.ClientContext
    :param parent_section:  section of the CLI to which the repo section
                            should be added
    :type  parent_section:  pulp.client.extensions.extensions.PulpCliSection
    """
    repo_section = parent_section.create_subsection(SECTION_REPO, DESC_REPO)
    repo_section.add_command(CreateDockerRepositoryCommand(context))
    repo_section.add_command(cudl.DeleteRepositoryCommand(context))
    repo_section.add_command(UpdateDockerRepositoryCommand(context))
    repo_section.add_command(ListDockerRepositoriesCommand(context))
    repo_section.add_command(TagUpdateCommand(context))
    add_search_section(context, repo_section)
    add_copy_section(context, repo_section)
    add_remove_section(context, repo_section)
    return repo_section
コード例 #4
0
 def setUp(self):
     self.context = mock.MagicMock()
     self.context.config = test_config
     self.command = TagUpdateCommand(self.context)
コード例 #5
0
 def setUp(self):
     self.context = mock.MagicMock()
     self.context.config = test_config
     self.command = TagUpdateCommand(self.context)