mock.assert_called_once() is not a valid method

mock.assert_called_once() is a no-op that tests nothing. Instead
mock.assert_called_once_with() should be used (or use
assertEqual(1, mock_obj.call_count) if you don't want to check
parameters).

Borrowed HACKING rule from Davanum Srinivas's nova patch to
prevent it from appearing again.

Change-Id: Idac1d3c89c07e13c9a209663f4e557fcb7547821
Closes-Bug: #1365751
Closes-Bug: #1300265
This commit is contained in:
Jacek Swiderski 2014-09-23 14:35:06 +02:00
parent 8200868865
commit 8bdbbb35a6
1 changed files with 1 additions and 0 deletions

View File

@ -12,6 +12,7 @@ Neutron Specific Commandments
- [N321] Validate that jsonutils module is used instead of json
- [N322] We do not use @authors tags in source files. We have git to track
authorship.
- [N323] assert_called_once() is not a valid method
Creating Unit Tests
-------------------