def test_fetch_archive(self):
        with patch('sys.stdout', new_callable=StringIO) as out:
            with patch('lacli.command.ask_key') as ask_key:
                ask_key.return_value = 'DEADBEEF' * 8
                registry = Mock()
                registry.prefs = self.prefs
                registry.cache.save_cert.return_value = ('LALA', None)

                registry.session.archives.return_value = (dummyarchive,)
                cli = self._makeit(registry)
                cli.onecmd('fetch baz')
                self.assertThat(out.getvalue(),
                                Contains('Fetched certificate LALA'))

                docs = registry.cache.save_cert.call_args[0][0]
                self.assertTrue('cert' in docs)
                self.assertTrue('archive' in docs)
                self.assertTrue('signature' in docs)
                self.assertEqual(docs['archive'].title, 'faz')
dataset/ETHPy150Open longaccess/longaccess-client/lacli/t/test_fetch_command.py/FetchCommandTest.test_fetch_archive/original