X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/3a1f0b616382230c32439b8d7e17ff75a132a10d..3513c7def7eacdeef16c355f1b9be93830dcf946:/sdk/python/tests/test_arv_put.py diff --git a/sdk/python/tests/test_arv_put.py b/sdk/python/tests/test_arv_put.py index 52063f2a15..7a0120c028 100644 --- a/sdk/python/tests/test_arv_put.py +++ b/sdk/python/tests/test_arv_put.py @@ -283,8 +283,8 @@ class ArvPutUploadJobTest(run_test_server.TestCaseWithServers, # Don't destroy the cache, and start another upload cwriter_new = arv_put.ArvPutUploadJob([f.name]) cwriter_new.start() - self.assertEqual(0, cwriter_new.bytes_written) cwriter_new.destroy_cache() + self.assertEqual(0, cwriter_new.bytes_written) def make_progress_tester(self): progression = [] @@ -434,9 +434,8 @@ class ArvadosPutTest(run_test_server.TestCaseWithServers, ArvadosBaseTestCase): os.chmod(cachedir, 0o700) def test_put_block_replication(self): - with mock.patch('arvados.collection.KeepClient.local_store_put') as put_mock, \ - mock.patch('arvados.commands.put.ResumeCache.load') as cache_mock: - cache_mock.side_effect = ValueError + self.call_main_on_test_file() + with mock.patch('arvados.collection.KeepClient.local_store_put') as put_mock: put_mock.return_value = 'acbd18db4cc2f85cedef654fccc4a4d8+3' self.call_main_on_test_file(['--replication', '1']) self.call_main_on_test_file(['--replication', '4']) @@ -478,12 +477,13 @@ class ArvadosPutTest(run_test_server.TestCaseWithServers, ArvadosBaseTestCase): coll_save_mock = mock.Mock(name='arv.collection.Collection().save_new()') coll_save_mock.side_effect = arvados.errors.ApiError( fake_httplib2_response(403), '{}') - arvados.collection.Collection.save_new = coll_save_mock - with self.assertRaises(SystemExit) as exc_test: - self.call_main_with_args(['/dev/null']) - self.assertLess(0, exc_test.exception.args[0]) - self.assertLess(0, coll_save_mock.call_count) - self.assertEqual("", self.main_stdout.getvalue()) + with mock.patch('arvados.collection.Collection.save_new', + new=coll_save_mock): + with self.assertRaises(SystemExit) as exc_test: + self.call_main_with_args(['/dev/null']) + self.assertLess(0, exc_test.exception.args[0]) + self.assertLess(0, coll_save_mock.call_count) + self.assertEqual("", self.main_stdout.getvalue()) class ArvPutIntegrationTest(run_test_server.TestCaseWithServers,