Skip to content

Commit

Permalink
tests: Mock out logging in test_successful_invite_user_with_name_and_…
Browse files Browse the repository at this point in the history
…normal_one.

Fixes zulip#7563
  • Loading branch information
hackerkid committed Nov 30, 2017
1 parent dbe08ab commit 8d6290e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion zerver/tests/test_signup.py
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,8 @@ def test_successful_invite_user_with_name(self, mock_info: MagicMock) -> None:
self.assertTrue(find_key_by_email(email))
self.check_sent_emails([email], custom_from_name="Hamlet")

def test_successful_invite_user_with_name_and_normal_one(self) -> None:
@patch("logging.info")
def test_successful_invite_user_with_name_and_normal_one(self, mock_info: MagicMock) -> None:
"""
A call to /json/invites with valid parameters causes an invitation
email to be sent.
Expand All @@ -569,6 +570,9 @@ def test_successful_invite_user_with_name_and_normal_one(self) -> None:
email2 = "bob-test@zulip.com"
invitee = "Alice Test <{}>, {}".format(email, email2)
self.assert_json_success(self.invite(invitee, ["Denmark"]))
c1 = call("Sending invitation for realm zulip to alice-test@zulip.com")
c2 = call("Sending invitation for realm zulip to bob-test@zulip.com")
mock_info.assert_has_calls([c1, c2], any_order=True)
self.assertTrue(find_key_by_email(email))
self.assertTrue(find_key_by_email(email2))
self.check_sent_emails([email, email2], custom_from_name="Hamlet")
Expand Down

0 comments on commit 8d6290e

Please sign in to comment.