forked from oppia/oppia
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
…0272) * Make MailChimp Error Handling Comprehensive Ensure that all errors from MailChimp while signing a user up for the mailing list are caught, even those errors that arise when trying to handle missing users. * Fix linter
- Loading branch information
Showing
2 changed files
with
56 additions
and
40 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
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 |
---|---|---|
|
@@ -353,7 +353,10 @@ def test_add_or_update_mailchimp_user_status(self) -> None: | |
self.user_email_1, {}, 'Web', | ||
can_receive_email_updates=True) | ||
self.assertItemsEqual( | ||
['Mailchimp error prevented email signup: Server Error'], | ||
[ | ||
'Mailchimp error prevented email signup: ' | ||
'{\'status\': 401, \'detail\': \'Server Error\'}' | ||
], | ||
logs | ||
) | ||
|
||
|
@@ -399,11 +402,14 @@ def test_catch_or_raise_errors_when_creating_new_invalid_user(self) -> None: | |
self.assertEqual(len(mailchimp.lists.members.users_data), 3) | ||
|
||
# Create user raises exception for other errors. | ||
with self.assertRaisesRegex( | ||
Exception, 'Server Issue'): | ||
with self.capture_logging(min_level=logging.ERROR) as logs: | ||
mailchimp_bulk_email_services.add_or_update_user_status( | ||
'[email protected]', {}, 'Web', | ||
can_receive_email_updates=True) | ||
self.assertItemsEqual( | ||
['Mailchimp error prevented email signup: Server Issue'], | ||
logs | ||
) | ||
|
||
def test_permanently_delete_user(self) -> None: | ||
mailchimp = self.MockMailchimpClass() | ||
|