Пример #1
0
def initialize(context):
    structure.ensure_repo_structure(context.cli)
    upload_manager = _upload_manager(context)

    repo_section = structure.repo_section(context.cli)
    repo_section.add_command(repo_create_update.PkgRepoCreateCommand(context))
    repo_section.add_command(repo_create_update.PkgRepoUpdateCommand(context))
    repo_section.add_command(cudl.DeleteRepositoryCommand(context))
    repo_section.add_command(repo_list.RepoListCommand(context))
    repo_section.add_command(
        RepoSearchCommand(context, constants.REPO_NOTE_PKG))

    copy_section = structure.repo_copy_section(context.cli)
    copy_section.add_command(copy_commands.MsiCopyCommand(context))
    copy_section.add_command(copy_commands.MsmCopyCommand(context))
    copy_section.add_command(copy_commands.AllCopyCommand(context))

    remove_section = structure.repo_remove_section(context.cli)
    remove_section.add_command(remove.MsiRemoveCommand(context))
    remove_section.add_command(remove.MsmRemoveCommand(context))

    contents_section = structure.repo_contents_section(context.cli)
    contents_section.add_command(contents.SearchMsiCommand(context))
    contents_section.add_command(contents.SearchMsmCommand(context))

    uploads_section = structure.repo_uploads_section(context.cli)
    for cls_ in [
            package.CreateMsiCommand, package.CreateMsmCommand,
            upload.ResumeCommand, upload.CancelCommand, upload.ListCommand
    ]:
        uploads_section.add_command(cls_(context, upload_manager))

    sync_section = structure.repo_sync_section(context.cli)
    renderer = status.PackageStatusRenderer(context)
    sync_section.add_command(
        sync_publish.RunSyncRepositoryCommand(context, renderer))
    sync_section.add_command(sync_publish.SyncStatusCommand(context, renderer))

    publish_section = structure.repo_publish_section(context.cli)
    renderer = PublishStepStatusRenderer(context)
    distributor_id = ids.TYPE_ID_DISTRIBUTOR_WIN
    publish_section.add_command(
        sync_publish.RunPublishRepositoryCommand(context, renderer,
                                                 distributor_id))
    publish_section.add_command(
        sync_publish.PublishStatusCommand(context, renderer))

    sync_schedules_section = structure.repo_sync_schedules_section(context.cli)
    sync_schedules_section.add_command(
        sync_schedules.PkgCreateScheduleCommand(context))
    sync_schedules_section.add_command(
        sync_schedules.PkgUpdateScheduleCommand(context))
    sync_schedules_section.add_command(
        sync_schedules.PkgDeleteScheduleCommand(context))
    sync_schedules_section.add_command(
        sync_schedules.PkgListScheduleCommand(context))

    sync_schedules_section.add_command(
        sync_schedules.PkgNextRunCommand(context))
Пример #2
0
    def test_msi_copy_command(self):
        # Test
        command = copy_commands.MsiCopyCommand(self.context)

        # Verify
        self.assertTrue(isinstance(command, copy_commands.PackageCopyCommand))
        self.assertEqual(command.name, TYPE_ID_MSI)
        self.assertEqual(command.description, copy_commands.DESC_MSI)
        self.assertEqual(command.type_id, TYPE_ID_MSI)
Пример #3
0
    def test_modify_user_input(self, mock_super):
        command = copy_commands.MsiCopyCommand(self.context, 'copy')
        user_input = {'a': 'a'}
        command.modify_user_input(user_input)

        # The super call is required.
        self.assertEqual(1, mock_super.call_count)

        # The user_input variable itself should be modified.
        self.assertEqual(user_input, {'a': 'a'})
Пример #4
0
 def test_sort(self, mock_parse):
     command = copy_commands.MsiCopyCommand(self.context, 'copy')
     command._parse_sort('foo')
     mock_parse.assert_called_once_with(copy_commands.RecursiveCopyCommand,
                                        'foo')
Пример #5
0
 def test_key_value(self, mock_parse):
     command = copy_commands.MsiCopyCommand(self.context, 'copy')
     command._parse_key_value('foo')
     mock_parse.assert_called_once_with('foo')