mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-03 21:43:21 +00:00 
			
		
		
		
	tests: Fix bugs confusing recipient.type_id for other ids.
These tests were accidentally passing due to numbers coinciding.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							3f4f16f4f1
						
					
				
				
					commit
					b8c8ea5262
				
			@@ -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:
 | 
			
		||||
 
 | 
			
		||||
@@ -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:
 | 
			
		||||
        """
 | 
			
		||||
 
 | 
			
		||||
@@ -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:
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user