Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

tests: Fix bugs confusing recipient.type_id for other ids.

Mateusz Manderab8c8ea526209
diff --git a/zerver/tests/test_email_mirror.py b/zerver/tests/test_email_mirror.py
index 95ed80197e3..ae36367402f 100644
--- a/zerver/tests/test_email_mirror.py
+++ b/zerver/tests/test_email_mirror.py
@@ -761,7 +761,7 @@ class TestMissedMessageEmailMessages(ZulipTestCase):
self.assertEqual(message.content, "TestMissedMessageEmailMessages Body")
self.assertEqual(message.sender, self.example_user('othello'))
- self.assertEqual(message.recipient.id, user_profile.id)
+ self.assertEqual(message.recipient.type_id, user_profile.id)
self.assertEqual(message.recipient.type, Recipient.PERSONAL)
def test_receive_missed_huddle_message_email_messages(self) -> None:
diff --git a/zerver/tests/test_message_send.py b/zerver/tests/test_message_send.py
index 724f5312fe7..b2ab3b13e3d 100644
--- a/zerver/tests/test_message_send.py
+++ b/zerver/tests/test_message_send.py
@@ -371,7 +371,7 @@ class MessagePOSTTest(ZulipTestCase):
msg = self.get_last_message()
self.assertEqual("Test message", msg.content)
- self.assertEqual(msg.recipient_id, self.example_user("othello").id)
+ self.assertEqual(msg.recipient_id, self.example_user("othello").recipient_id)
def test_group_personal_message_by_id(self) -> None:
"""
diff --git a/zerver/tests/test_outgoing_webhook_system.py b/zerver/tests/test_outgoing_webhook_system.py
index 334a2415c8f..3b06a727ec6 100644
--- a/zerver/tests/test_outgoing_webhook_system.py
+++ b/zerver/tests/test_outgoing_webhook_system.py
@@ -86,7 +86,7 @@ class DoRestCallTests(ZulipTestCase):
The webhook got a response with status code *500*.''')
assert bot_user.bot_owner is not None
- self.assertEqual(bot_owner_notification.recipient_id, bot_user.bot_owner.id)
+ self.assertEqual(bot_owner_notification.recipient_id, bot_user.bot_owner.recipient_id)
def test_fail_request(self) -> None:
bot_user = self.example_user('outgoing_webhook_bot')
@@ -111,7 +111,7 @@ The webhook got a response with status code *500*.''')
The webhook got a response with status code *400*.''')
assert bot_user.bot_owner is not None
- self.assertEqual(bot_owner_notification.recipient_id, bot_user.bot_owner.id)
+ self.assertEqual(bot_owner_notification.recipient_id, bot_user.bot_owner.recipient_id)
def test_headers(self) -> None:
bot_user = self.example_user('outgoing_webhook_bot')
@@ -149,7 +149,7 @@ The webhook got a response with status code *400*.''')
self.assertIn(error_text, bot_owner_notification.content)
self.assertIn('triggered', bot_owner_notification.content)
assert bot_user.bot_owner is not None
- self.assertEqual(bot_owner_notification.recipient_id, bot_user.bot_owner.id)
+ self.assertEqual(bot_owner_notification.recipient_id, bot_user.bot_owner.recipient_id)
with self.assertLogs(level="INFO") as i:
helper(side_effect=timeout_error, error_text='A timeout occurred.')
@@ -188,7 +188,7 @@ When trying to send a request to the webhook service, an exception of type Reque
I'm a generic exception :(
```''')
assert bot_user.bot_owner is not None
- self.assertEqual(bot_owner_notification.recipient_id, bot_user.bot_owner.id)
+ self.assertEqual(bot_owner_notification.recipient_id, bot_user.bot_owner.recipient_id)
class TestOutgoingWebhookMessaging(ZulipTestCase):
def create_outgoing_bot(self, bot_owner: UserProfile) -> UserProfile: