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
@@ -41,7 +41,10 @@ class TestCommandRollerShutter(unittest.TestCase):
|
||||
mock_run.return_value = b' foo bar '
|
||||
result = self.rs._query_state_value('runme')
|
||||
self.assertEqual('foo bar', result)
|
||||
mock_run.assert_called_once_with('runme', shell=True)
|
||||
self.assertEqual(mock_run.call_count, 1)
|
||||
self.assertEqual(
|
||||
mock_run.call_args, mock.call('runme', shell=True)
|
||||
)
|
||||
|
||||
def test_state_value(self):
|
||||
"""Test with state value."""
|
||||
|
||||
Reference in new issue
Block a user