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

These tests were accidentally passing due to numbers coinciding.
This commit is contained in:
Mateusz Mandera
2021-02-02 14:09:11 +01:00
committed by Tim Abbott
parent 3f4f16f4f1
commit b8c8ea5262
3 changed files with 6 additions and 6 deletions

View File

@@ -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:

View File

@@ -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:
"""

View File

@@ -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: