async def test_svn_get_components_with_new_release_return_empty_set_if_command_timeout( self, loop): svn = Subversion(loop=None) fut = asyncio.Future(loop=loop) fut.set_exception(ExecutionFailure("Timeout reached")) svn._get_last_release_date_of_components = MagicMock(return_value=fut) result = await svn.get_components_with_new_release( "plugins", "http://plugins.svn.example.com/", date.today()) self.assertEqual(result, set())
async def test_execution_failures(self, fake_future): workspace = MagicMock() workspace.list_versions.return_value = fake_future( ["1.0", "10.1", "2.0"]) hasher = RepositoryHasher(storage=MagicMock(), hasher=MagicMock()) hasher.collect_for_version = MagicMock() hasher.collect_for_version.side_effect = ExecutionFailure() hasher.storage.read_versions.side_effect = FileNotFoundError() await hasher.collect_for_workspace( "plugins/a-plugin", workspace, prefix="wp-content/plugins/a-plugin") hasher.storage.read_versions.assert_called_with("plugins/a-plugin") hasher.collect_for_version.assert_has_calls([ call(workspace, "1.0", prefix="wp-content/plugins/a-plugin"), ], any_order=False) hasher.storage.write_versions.assert_not_called()
async def test_failure_to_list(self, loop): handler = WordPressRepository(loop=loop, subversion=MagicMock()) handler.subversion.ls.side_effect = ExecutionFailure() with self.assertRaises(RepositoryUnreachable): await handler.enumerate_plugins()