-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8715 from cfpb/fix/mock-called-with-tests
Fix incorrect Python tests using mock.called_with
- Loading branch information
Showing
4 changed files
with
46 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,17 +53,17 @@ def test_api_command_calls_update(self, mock_update): | |
self.assertTrue(mock_update.call_count == 1) | ||
call_command("update_via_api", "--school_id", "999999") | ||
self.assertTrue(mock_update.call_count == 2) | ||
self.assertTrue(mock_update.called_with(single_school=999999)) | ||
mock_update.assert_called_with(single_school="999999") | ||
call_command( | ||
"update_via_api", "--school_id", "999999", "--save_programs" | ||
) | ||
self.assertTrue(mock_update.call_count == 3) | ||
self.assertTrue( | ||
mock_update.called_with(single_school=999999, store_programs=True) | ||
mock_update.assert_called_with( | ||
single_school="999999", store_programs=True | ||
) | ||
call_command("update_via_api", "--save_programs") | ||
self.assertTrue(mock_update.call_count == 4) | ||
self.assertTrue(mock_update.called_with(store_programs=True)) | ||
mock_update.assert_called_with(store_programs=True) | ||
|
||
@mock.patch( | ||
"paying_for_college.management.commands." | ||
|
@@ -111,7 +111,7 @@ def test_retry_notifications(self, mock_retry): | |
self.assertEqual(mock_retry.call_count, 1) | ||
call_command("retry_notifications", "--days", "2") | ||
self.assertEqual(mock_retry.call_count, 2) | ||
self.assertTrue(mock_retry.called_with(days=2)) | ||
mock_retry.assert_called_with(days=2) | ||
|
||
@mock.patch( | ||
"paying_for_college.management.commands." | ||
|
@@ -125,4 +125,4 @@ def test_send_stale_notifications(self, mock_send): | |
"send_stale_notifications", "--add-email", "[email protected]" | ||
) | ||
self.assertEqual(mock_send.call_count, 2) | ||
self.assertTrue(mock_send.called_with(add_email=["[email protected]"])) | ||
mock_send.assert_called_with(add_email=["[email protected]"]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters