Ejemplo n.º 1
0
    def test_generate_unit_key(self):
        """
        Assert that generate_unit_key() returns the empty dictionary.
        """
        command = upload.UploadPackageCommand(mock.MagicMock())

        key = command.generate_unit_key('some', 'args', and_some='kwargs')

        self.assertEqual(key, {})
Ejemplo n.º 2
0
    def test_determine_type_id(self):
        """
        Assert that determine_type_id() returns the correct type.
        """
        command = upload.UploadPackageCommand(mock.MagicMock())

        type_id = command.determine_type_id('some_file_name', some='kwargs')

        self.assertEqual(type_id, constants.PACKAGE_TYPE_ID)
Ejemplo n.º 3
0
    def test_generate_unit_key(self):
        """
        Assert that generate_unit_key() returns a dict containing the filename.
        """
        command = upload.UploadPackageCommand(mock.MagicMock())

        key = command.generate_unit_key('some', 'args', and_some='kwargs')

        self.assertEqual(key, {'filename': 'some'})
Ejemplo n.º 4
0
    def test_generate_unit_key_with_path(self):
        """
        Assert that generate_unit_key() dict contains filename when the argument is a path.
        """
        command = upload.UploadPackageCommand(mock.MagicMock())

        key = command.generate_unit_key('path/mock_file',
                                        'args',
                                        and_some='kwargs')

        self.assertEqual(key, {'filename': 'mock_file'})
Ejemplo n.º 5
0
def _add_repo_section(context, parent_section):
    """
    add a repo section to the python section

    :param context:         The client context
    :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(CreatePythonRepositoryCommand(context))
    repo_section.add_command(UpdatePythonRepositoryCommand(context))
    repo_section.add_command(cudl.DeleteRepositoryCommand(context))
    repo_section.add_command(ListPythonRepositoriesCommand(context))

    _add_publish_section(context, repo_section)
    _add_sync_section(context, repo_section)

    repo_section.add_command(upload.UploadPackageCommand(context))
    repo_section.add_command(packages.RemovePackagesCommand(context))
    repo_section.add_command(packages.CopyPackagesCommand(context))
    repo_section.add_command(packages.ListPackagesCommand(context))