test_hooks: Use send_json_payload for private message tests.

This commit is contained in:
Tim Abbott
2016-06-30 15:11:02 -07:00
parent a78c1b9750
commit 0397855fdd
2 changed files with 7 additions and 5 deletions

View File

@@ -423,7 +423,9 @@ class AuthedTestCase(TestCase):
# Check the correct message was sent
msg = self.get_last_message()
self.assertEqual(msg.sender.email, email)
self.assertEqual(get_display_recipient(msg.recipient), stream_name)
if stream_name is not None:
self.assertEqual(get_display_recipient(msg.recipient), stream_name)
# TODO: should also validate recipient for private messages
return msg

View File

@@ -45,12 +45,12 @@ class WebhookTestCase(AuthedTestCase):
if content_type is not None:
kwargs['content_type'] = content_type
result = self.client.post(self.url, payload, content_type=content_type)
self.assert_json_success(result)
msg = self.get_last_message()
msg = self.send_json_payload(self.TEST_USER_EMAIL, self.url, payload,
stream_name=None, **kwargs)
self.do_test_message(msg, expected_message)
return msg
def build_webhook_url(self):
# type: () -> text_type
api_key = self.get_api_key(self.TEST_USER_EMAIL)