Commit graph

17 commits

Author SHA1 Message Date
neiljp (Neil Pilgrim) 62d781a53e TicTacToe tests: Extend tests to end of game draw condition & quit. 2017-12-12 17:11:29 -06:00
Steve Howell f69d71c3b1 bots: Remove unneeded __future__ imports. 2017-12-12 07:32:14 -06:00
Steve Howell fd069dff82 lint: Require python3 shebangs.
This commit was originally from @fredfishgames, but it
needed a big rebase due to use letting it sit too long.
Also, we decided not to have shebangs at the top of test
files.
2017-12-12 07:14:16 -06:00
Steve Howell 6087cf95e2 bot tests: Use StubBotTestCase in tictactoe.
Note that we now only have one conversation, since the case
of sending to streams has the same mechanics as sending PMs.

We'll eventually want a separate test to drive out differences
in the actual mechanics of the reply.
2017-12-01 07:00:20 -08:00
Robert Hönig ea6ddb2312 zulip_bots: Only cache storage.get(). Don't cache put(). 2017-11-24 10:44:34 -08:00
derAnfaenger 2a74ad11c5 zulip_bots: Make StateHandler optional.
This has the convenient side-effect of making
the bot_handler.storage attribute read-only.
2017-11-18 08:58:47 -08:00
derAnfaenger daad7f24e4 bots: Set JSON as default serializer for StateHandler.
With this change, StateHandler.put() does only accept JSON-able
objects by default. The incrementor test tried to store the return
value of send_reply(), a non-JSON-able MockObject, in the state.
Therefore, this commits also sets functional default test return
values for send_message() and send_reply().
Finally, it fixes the tictactoe bot which relied on directly
modifying the state_ attribute.
2017-11-18 08:58:47 -08:00
derAnfaenger 59f81845dd zulip_bots: Update StateHandler API to behave dict-like.
This matches the external StateHandler API with the embedded
StateHandler API.
2017-10-24 13:15:51 +02:00
derAnfaenger 32df4e097d tictactoe bot: Store game state in JSON-able format. 2017-10-24 13:03:41 +02:00
derAnfaenger 8179b30873 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.
2017-10-24 11:07:58 +02:00
derAnfaenger e331426c64 zulip_bots: Rename state_handler to storage. 2017-10-23 12:24:41 +02:00
derAnfaenger eb6982e670 zulip_bots: Make state_handler property of bot_handler. 2017-10-23 12:17:46 +02:00
neiljp (Neil Pilgrim) 37206db176 TicTacToe tests: Improve test coverage. 2017-08-24 10:24:41 -07:00
Eeshan Garg d63269ee6a zulip_bots: Rename bots/{bot}/readme.md -> bots/{bot}/doc.md.
doc.md better describes the style of documentation that will live
inside these files, since we want these to be similar to our
webhooks' doc.md files in terms of how these are rendered and
composed of Markdown macros.
2017-08-15 19:30:13 -07:00
neiljp (Neil Pilgrim) 3234096cea bot tests: Add preliminary tests for tictactoe bot, including state. 2017-07-25 10:45:00 -07:00
neiljp (Neil Pilgrim) 45527c4cf4 bots: Switch TicTacToe to use state_handler.state() contextmanager. 2017-07-24 17:22:17 -07:00
Eeshan Garg 879f44ab3a bots: Move all bots and the bots API to separate package. 2017-07-18 02:20:27 -02:30