From 749356d34b6bff758462359c0bdff362ceb88585 Mon Sep 17 00:00:00 2001 From: "neiljp (Neil Pilgrim)" Date: Thu, 27 Jul 2017 19:11:39 -0700 Subject: [PATCH] Incrementor tests: Preliminary coverage with no update_message support. --- .../bots/incrementor/test_incrementor.py | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 zulip_bots/zulip_bots/bots/incrementor/test_incrementor.py diff --git a/zulip_bots/zulip_bots/bots/incrementor/test_incrementor.py b/zulip_bots/zulip_bots/bots/incrementor/test_incrementor.py new file mode 100644 index 0000000..46156f0 --- /dev/null +++ b/zulip_bots/zulip_bots/bots/incrementor/test_incrementor.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python + +from __future__ import absolute_import +from __future__ import print_function + +from zulip_bots.test_lib import BotTestCase +from zulip_bots.lib import StateHandler + + +class TestIncrementorBot(BotTestCase): + bot_name = "incrementor" + + def test_bot(self): + messages = [ # Template for message inputs to test, absent of message content + { + 'type': 'stream', + 'display_recipient': 'some stream', + 'subject': 'some subject', + 'sender_email': 'foo_sender@zulip.com', + }, + { + 'type': 'private', + 'sender_email': 'foo_sender@zulip.com', + }, + ] + state_handler = StateHandler() + self.assert_bot_response(dict(messages[0], content=""), {'content': "1"}, + 'send_reply', state_handler) + # Last test commented out since we don't have update_message + # support in the test framework yet. + + # self.assert_bot_response(dict(messages[0], content=""), {'message_id': 5, 'content': "2"}, + # 'update_message', state_handler)