def test_do_list(self, mocked_pulp, caplog, silent): bopts = testbOpts() bargs = ['test-repo', '--content', '--details', '--labels'] if silent: bargs.append('--silent') p = testPulp() mocked_pulp.side_effect = [p] repos = [{'id': 'test-repo', 'detail': 'foobar', 'images': {'testimage': ['testtag']}, 'v1_labels': {'testimage': {'testkey': 'testval'}}, 'manifests': {'testmanifest': {'layers': ['testlayer1'], 'tags': ['testtag'], 'config': 'testconfig', 'schema_version': 'testsv', 'v1id': 'testv1id', 'v1parent': 'testv1parent', 'v1labels': 'testv1labels'}}, 'manifest_lists': {'testmanifestlist': {'mdigests': ['testmanifest'], 'tags': ['testtag']}}, 'tags': {'testtag': 'testmanifest'}, 'include_in_download_service': "True"}] (flexmock(testPulp) .should_receive('listRepos') .with_args(repos=[bargs[0]], content=True, history=True, labels=True, paginate=True) .and_return(repos)) caplog.setLevel(logging.INFO, logger="dockpulp") response = cli.do_list(bopts, bargs) if silent: output = caplog.text() jsontext = output[output.find('['):] assert json.loads(jsontext) == repos else: assert response is None
def test_do_list(self, mocked_pulp, caplog, silent): bopts = testbOpts() bargs = ['test-repo', '--content', '--details', '--labels'] if silent: bargs.append('--silent') p = testPulp() mocked_pulp.side_effect = [p] repos = [{ 'id': 'test-repo', 'detail': 'foobar', 'images': { 'testimage': ['testtag'] }, 'v1_labels': { 'testimage': { 'testkey': 'testval' } }, 'manifests': { 'testmanifest': { 'layers': ['testlayer1'], 'tags': ['testtag'], 'config': 'testconfig', 'schema_version': 'testsv', 'v1id': 'testv1id', 'v1parent': 'testv1parent', 'v1labels': 'testv1labels' } }, 'manifest_lists': { 'testmanifestlist': { 'mdigests': ['testmanifest'], 'tags': ['testtag'] } }, 'tags': { 'testtag': 'testmanifest' }, 'include_in_download_service': "True" }] (flexmock(testPulp).should_receive('listRepos').with_args( repos=[bargs[0]], content=True, history=True, labels=True, paginate=True).and_return(repos)) caplog.set_level(logging.INFO, logger="dockpulp") response = cli.do_list(bopts, bargs) if silent: output = caplog.text jsontext = output[output.find('['):] assert json.loads(jsontext) == repos else: assert response is None