bots: Pass through widget_content if passed in.

This commit is contained in:
Steve Howell 2018-05-21 10:04:36 +00:00 committed by showell
parent 488dcb4219
commit fcd39204a9
3 changed files with 14 additions and 9 deletions

View file

@ -110,16 +110,17 @@ class LibTest(TestCase):
)
to = {'email': 'Some@User'}
expected = [({'type': 'private', 'display_recipient': [to]},
{'type': 'private', 'to': [to['email']]}),
{'type': 'private', 'to': [to['email']]}, None),
({'type': 'private', 'display_recipient': [to, profile]},
{'type': 'private', 'to': [to['email']]}),
{'type': 'private', 'to': [to['email']]}, 'widget_content'),
({'type': 'stream', 'display_recipient': 'Stream name', 'subject': 'Topic'},
{'type': 'stream', 'to': 'Stream name', 'subject': 'Topic'})]
{'type': 'stream', 'to': 'Stream name', 'subject': 'Topic'}, 'test widget')]
response_text = "Response"
for test in expected:
client.send_message = MagicMock()
handler.send_reply(test[0], response_text)
client.send_message.assert_called_once_with(dict(test[1], content=response_text))
handler.send_reply(test[0], response_text, test[2])
client.send_message.assert_called_once_with(dict(
test[1], content=response_text, widget_content=test[2]))
def test_content_and_full_content(self):
client = FakeClient()