zulip_bots: Reify StateHandler testing.

This simplifies testing stateful bots by integrating the StateHandler
into the test library. As a side-effect, the mock bot handler gets
reused during a test, making the tests more realistic. The
StateHandler now keeps its state during a call to check_expected_responses,
forcing some stateful tests to be more verbose and explicit.
This commit is contained in:
derAnfaenger 2017-10-23 20:37:39 +02:00
parent e331426c64
commit 8179b30873
4 changed files with 60 additions and 68 deletions

View file

@ -23,9 +23,8 @@ class TestIncrementorBot(BotTestCase):
'sender_email': 'foo_sender@zulip.com',
},
]
storage = StateHandler()
self.assert_bot_response(dict(messages[0], content=""), {'content': "1"},
'send_reply', storage)
'send_reply')
# Last test commented out since we don't have update_message
# support in the test framework yet.