Removing calls to mock.assert_called_once_with (#3896)
If a mock's assert_called_once_with method is misspelled (e.g. asert_called_once_with) then the test will appear as passing. Therefore, this commit removes all instances of assert_called_once_with calls and replaces them with two assertions:
self.assertEqual(mock.call_count, 1)
self.assertEqual(mock.call_args, mock.call(call_args))
This commit is contained in:
1 parent
10c9132046
commit
4891ca1610
18 files changed
+308
-109
No files matched your search
@@ -84,6 +84,9 @@ class TestLogentries(unittest.TestCase):
|
||||
'logs/token',
|
||||
'event': body}
|
||||
self.handler_method(event)
|
||||
self.mock_post.assert_called_once_with(
|
||||
payload['host'], data=payload, timeout=10)
|
||||
self.assertEqual(self.mock_post.call_count, 1)
|
||||
self.assertEqual(
|
||||
self.mock_post.call_args,
|
||||
mock.call(payload['host'], data=payload, timeout=10)
|
||||
)
|
||||
self.mock_post.reset_mock()
|
||||
Reference in new issue
Block a user