Пример #1
0
 def test_init(self):
     context = mock.Mock()
     command = content.ManifestSearchCommand(context)
     self.assertEqual(command.context, context)
     self.assertEqual(command.name, 'manifest')
     self.assertEqual(command.prompt, context.prompt)
     self.assertFalse(command.description is None)
     self.assertEqual(command.method, command.run)
Пример #2
0
    def test_run(self):
        repo_id = '1234'
        context = mock.Mock()
        kwargs = {content.options.OPTION_REPO_ID.keyword: repo_id}
        command = content.ManifestSearchCommand(context)

        # test
        command.run(**kwargs)

        # validation
        context.server.repo_unit.search.assert_called_once_with(
            repo_id, type_ids=[constants.MANIFEST_TYPE_ID])
        context.prompt.render_document_list(
            context.server.repo_unit.search.return_value.response_body)
Пример #3
0
def add_search_section(context, parent_section):
    """
    Add the search section to the parent section.

    :param context: pulp context
    :type  context: pulp.client.extensions.core.ClientContext
    :param parent_section: section of the CLI to which the this section
        should be added
    :type  parent_section: pulp.client.extensions.extensions.PulpCliSection
    """
    section = parent_section.create_subsection(SECTION_SEARCH, DESC_SEARCH)
    section.add_command(ImageSearchCommand(context))
    section.add_command(content.ManifestSearchCommand(context))
    section.add_command(content.TagSearchCommand(context))
    return section