Extend message parameters passed in check_expected_responses

This commit is contained in:
neiljp 2017-06-19 14:42:49 -07:00 committed by showell
parent 9777496046
commit f1b3e943c6
1 changed files with 6 additions and 4 deletions

View File

@ -58,8 +58,8 @@ class BotTestCase(TestCase):
def check_expected_responses(self, expectations, expected_method='send_reply', def check_expected_responses(self, expectations, expected_method='send_reply',
email="foo_sender@zulip.com", recipient="foo", subject="foo", email="foo_sender@zulip.com", recipient="foo", subject="foo",
type="all"): sender_id=0, sender_full_name="Foo Bar", type="all"):
# type: (Dict[str, Any], str, str, str, str, str) -> None # type: (Dict[str, Any], str, str, str, str, int, str, str) -> None
# To test send_message, Any would be a Dict type, # To test send_message, Any would be a Dict type,
# to test send_reply, Any would be a str type. # to test send_reply, Any would be a str type.
if type not in ["private", "stream", "all"]: if type not in ["private", "stream", "all"]:
@ -71,11 +71,13 @@ class BotTestCase(TestCase):
response = {'content': r} if expected_method == 'send_reply' else r response = {'content': r} if expected_method == 'send_reply' else r
if type != "stream": if type != "stream":
message = {'content': m, 'type': "private", 'display_recipient': recipient, message = {'content': m, 'type': "private", 'display_recipient': recipient,
'sender_email': email} 'sender_email': email, 'sender_id': sender_id,
'sender_full_name': sender_full_name}
self.assert_bot_response(message=message, response=response, expected_method=expected_method) self.assert_bot_response(message=message, response=response, expected_method=expected_method)
if type != "private": if type != "private":
message = {'content': m, 'type': "stream", 'display_recipient': recipient, message = {'content': m, 'type': "stream", 'display_recipient': recipient,
'subject': subject, 'sender_email': email} 'subject': subject, 'sender_email': email, 'sender_id': sender_id,
'sender_full_name': sender_full_name}
self.assert_bot_response(message=message, response=response, expected_method=expected_method) self.assert_bot_response(message=message, response=response, expected_method=expected_method)
def call_request(self, message, expected_method, response): def call_request(self, message, expected_method, response):