Fixes for mock 1.1
The new release of mock 1.1 is more strict. It helped to find bugs in tests. Closes-Bug: #1473369 Change-Id: Id179513c6010d827cbcbdda7692a920e29213bcb
This commit is contained in:
parent
49e7c25876
commit
1cc3eff958
@ -1188,10 +1188,10 @@ class TestDBReplicator(unittest.TestCase):
|
||||
db_file = __file__
|
||||
replicator = TestReplicator({})
|
||||
replicator._http_connect(node, partition, db_file)
|
||||
db_replicator.ReplConnection.assert_has_calls(
|
||||
db_replicator.ReplConnection.assert_has_calls([
|
||||
mock.call(node, partition,
|
||||
os.path.basename(db_file).split('.', 1)[0],
|
||||
replicator.logger))
|
||||
replicator.logger)])
|
||||
|
||||
|
||||
class TestReplToNode(unittest.TestCase):
|
||||
|
@ -376,7 +376,7 @@ class TestWSGI(unittest.TestCase):
|
||||
_eventlet.patcher.monkey_patch.assert_called_with(all=False,
|
||||
socket=True)
|
||||
_eventlet.debug.hub_exceptions.assert_called_with(False)
|
||||
_wsgi.server.assert_called()
|
||||
self.assertTrue(_wsgi.server.called)
|
||||
args, kwargs = _wsgi.server.call_args
|
||||
server_sock, server_app, server_logger = args
|
||||
self.assertEquals(sock, server_sock)
|
||||
@ -419,7 +419,7 @@ class TestWSGI(unittest.TestCase):
|
||||
sock = listen(('localhost', 0))
|
||||
wsgi.run_server(conf, logger, sock)
|
||||
|
||||
_wsgi.server.assert_called()
|
||||
self.assertTrue(_wsgi.server.called)
|
||||
args, kwargs = _wsgi.server.call_args
|
||||
self.assertEquals(kwargs.get('capitalize_response_headers'), False)
|
||||
|
||||
@ -464,7 +464,7 @@ class TestWSGI(unittest.TestCase):
|
||||
_eventlet.patcher.monkey_patch.assert_called_with(all=False,
|
||||
socket=True)
|
||||
_eventlet.debug.hub_exceptions.assert_called_with(False)
|
||||
_wsgi.server.assert_called()
|
||||
self.assertTrue(_wsgi.server.called)
|
||||
args, kwargs = _wsgi.server.call_args
|
||||
server_sock, server_app, server_logger = args
|
||||
self.assertEquals(sock, server_sock)
|
||||
@ -515,7 +515,7 @@ class TestWSGI(unittest.TestCase):
|
||||
_eventlet.patcher.monkey_patch.assert_called_with(all=False,
|
||||
socket=True)
|
||||
_eventlet.debug.hub_exceptions.assert_called_with(True)
|
||||
mock_server.assert_called()
|
||||
self.assertTrue(mock_server.called)
|
||||
args, kwargs = mock_server.call_args
|
||||
server_sock, server_app, server_logger = args
|
||||
self.assertEquals(sock, server_sock)
|
||||
|
@ -3170,7 +3170,7 @@ class DiskFileMixin(BaseDiskFileTestMixin):
|
||||
reader.zero_copy_send(devnull.fileno())
|
||||
|
||||
# Assert the end of `zero_copy_send` was reached
|
||||
mock_close.assert_called()
|
||||
self.assertTrue(mock_close.called)
|
||||
# Assert there was at least one call to `trampoline` waiting for
|
||||
# `write` access to the output FD
|
||||
mock_trampoline.assert_any_call(devnull.fileno(), write=True)
|
||||
|
@ -742,7 +742,7 @@ class TestObjectExpirer(TestCase):
|
||||
x = expirer.ObjectExpirer({})
|
||||
x.swift.make_request = mock.MagicMock()
|
||||
x.delete_actual_object(name, timestamp)
|
||||
x.swift.make_request.assert_called_once()
|
||||
self.assertEqual(x.swift.make_request.call_count, 1)
|
||||
self.assertEqual(x.swift.make_request.call_args[0][1],
|
||||
'/v1/' + urllib.quote(name))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user