Skip to content

Commit e1d4173

Browse files
committed
test: fix called_once_withh in test_create_netbox_object_check_mode_false
Calling `MagicMock.called_once_with` returns a mock object and asserting that always succeeds. Replace this call with `MagicMock.assert_called_with` in `test_create_netbox_object_check_mode_false` since `endpoint_mock.create` is called twice: once in the test setup and once by `_create_netbox_object`. Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
1 parent 9bddc60 commit e1d4173

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/unit/module_utils/test_netbox_base_class.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ def test_create_netbox_object_check_mode_false(
300300
serialized_obj, diff = mock_netbox_module._create_netbox_object(
301301
endpoint_mock, normalized_data
302302
)
303-
assert endpoint_mock.create.called_once_with(normalized_data)
303+
endpoint_mock.create.assert_called_with(normalized_data)
304304
assert serialized_obj.serialize() == return_value
305305
assert diff == on_creation_diff
306306

0 commit comments

Comments
 (0)