def test_details_false(self, mock_search):
        mock_search.return_value.response_body = RPM_DOCUMENTS

        contents._content_command(self.context, ['rpm'], **{'repo-id':'repo1', 'limit':1})
        mock_search.assert_called_once_with('repo1', type_ids=['rpm'], limit=1)

        # make sure it outputs the unit only with attributes in order
        self.assertTrue(self.recorder.lines[0].startswith('Arch:'))
        self.assertTrue(self.recorder.lines[1].startswith('Buildhost:'))
        self.assertTrue(self.recorder.lines[2].startswith('Checksum:'))
    def test_details_true(self, mock_search):
        mock_search.return_value.response_body = RPM_DOCUMENTS

        contents._content_command(
            self.context, ['rpm'], **{'repo-id':'repo1', 'limit':1,
            DisplayUnitAssociationsCommand.ASSOCIATION_FLAG.keyword:True}
        )

        # make sure we get the unit and association data
        self.assertTrue([l for l in self.recorder.lines if l.startswith('Metadata:')])
        self.assertTrue([l for l in self.recorder.lines if l.startswith('  Arch:')])
        self.assertTrue([l for l in self.recorder.lines if l.startswith('Repo Id:')])
        self.assertTrue([l for l in self.recorder.lines if l.startswith('Updated:')])
 def test_basic_call(self, mock_search):
     contents._content_command(self.context, ['rpm'], **{'repo-id':'repo1', 'limit':1})
     mock_search.assert_called_once_with('repo1', type_ids=['rpm'], limit=1)