Remove usage of assert_called_once in mocks

This was never a real part of the mock api, but mock was happily mocking
it out and letting the tests pass. The new mock release made this
behaviour break, causing tests to fail on all patches. This patch
replaces instances of assert_called_once with an assert of the mock's
call_count.

Change-Id: I41ea0456acda86147ce3a7da0311e926782b4542
Closes-Bug: #1473369
This commit is contained in:
Mike Fedosin
2015-07-10 18:55:46 +03:00
parent 1ee5b95764
commit ec025eb9e5

View File

@@ -830,7 +830,7 @@ class SwiftTests(object):
loc = location.get_location_from_uri(uri, conf=self.conf)
self.store.delete(loc)
mock_del_obj.assert_called_once()
self.assertEqual(1, mock_del_obj.call_count)
_, kwargs = mock_del_obj.call_args
self.assertEqual('multipart-manifest=delete',
kwargs.get('query_string'))
@@ -851,7 +851,7 @@ class SwiftTests(object):
loc = location.get_location_from_uri(uri, conf=self.conf)
self.store.delete(loc)
mock_del_obj.assert_called_once()
self.assertEqual(1, mock_del_obj.call_count)
_, kwargs = mock_del_obj.call_args
self.assertEqual(None, kwargs.get('query_string'))