mirror of https://github.com/zulip/zulip.git
test_webhooks_common: Compare users by id not email.
Comparing by email can be incorrect, as different UserProfile can share the same .email if they're in different realm.
This commit is contained in:
parent
86c330b752
commit
1652e5c031
|
@ -55,7 +55,7 @@ class WebhooksCommonTestCase(ZulipTestCase):
|
||||||
integration_name="test_webhook",
|
integration_name="test_webhook",
|
||||||
support_email=FromAddress.SUPPORT,
|
support_email=FromAddress.SUPPORT,
|
||||||
).rstrip()
|
).rstrip()
|
||||||
self.assertEqual(msg.sender.email, notification_bot.email)
|
self.assertEqual(msg.sender.id, notification_bot.id)
|
||||||
self.assertEqual(msg.content, expected_message)
|
self.assertEqual(msg.content, expected_message)
|
||||||
|
|
||||||
def test_notify_bot_owner_on_invalid_json(self) -> None:
|
def test_notify_bot_owner_on_invalid_json(self) -> None:
|
||||||
|
@ -90,7 +90,7 @@ class WebhooksCommonTestCase(ZulipTestCase):
|
||||||
my_webhook_notify(request)
|
my_webhook_notify(request)
|
||||||
msg = self.get_last_message()
|
msg = self.get_last_message()
|
||||||
self.assertNotEqual(msg.id, last_message_id)
|
self.assertNotEqual(msg.id, last_message_id)
|
||||||
self.assertEqual(msg.sender.email, self.notification_bot().email)
|
self.assertEqual(msg.sender.id, self.notification_bot().id)
|
||||||
self.assertEqual(msg.content, expected_msg.strip())
|
self.assertEqual(msg.content, expected_msg.strip())
|
||||||
|
|
||||||
@patch("zerver.lib.webhooks.common.importlib.import_module")
|
@patch("zerver.lib.webhooks.common.importlib.import_module")
|
||||||
|
@ -198,11 +198,11 @@ class MissingEventHeaderTestCase(WebhookTestCase):
|
||||||
integration_name="Groove",
|
integration_name="Groove",
|
||||||
support_email=FromAddress.SUPPORT,
|
support_email=FromAddress.SUPPORT,
|
||||||
).rstrip()
|
).rstrip()
|
||||||
if msg.sender.email != notification_bot.email: # nocoverage
|
if msg.sender.id != notification_bot.id: # nocoverage
|
||||||
# This block seems to fire occasionally; debug output:
|
# This block seems to fire occasionally; debug output:
|
||||||
print(msg)
|
print(msg)
|
||||||
print(msg.content)
|
print(msg.content)
|
||||||
self.assertEqual(msg.sender.email, notification_bot.email)
|
self.assertEqual(msg.sender.id, notification_bot.id)
|
||||||
self.assertEqual(msg.content, expected_message)
|
self.assertEqual(msg.content, expected_message)
|
||||||
|
|
||||||
def get_body(self, fixture_name: str) -> str:
|
def get_body(self, fixture_name: str) -> str:
|
||||||
|
|
Loading…
Reference in New Issue