diff --git a/zulip_bots/zulip_bots/bots/tictactoe/tictactoe.py b/zulip_bots/zulip_bots/bots/tictactoe/tictactoe.py index 88d244f..d02f988 100644 --- a/zulip_bots/zulip_bots/bots/tictactoe/tictactoe.py +++ b/zulip_bots/zulip_bots/bots/tictactoe/tictactoe.py @@ -299,6 +299,7 @@ class ticTacToeHandler(object): return_content = TicTacToeGame.detailed_help_message elif (user_game) and TicTacToeGame.check_validity(user_game, TicTacToeGame.sanitize_move(user_game, command)): return_content = TicTacToeGame.tictactoe(user_game, user_board, command) + storage.put(original_sender, user_board) elif (user_game) and command == 'quit': storage.put(original_sender, None) return_content = "You've successfully quit the game." diff --git a/zulip_bots/zulip_bots/lib.py b/zulip_bots/zulip_bots/lib.py index a51b81f..6996122 100644 --- a/zulip_bots/zulip_bots/lib.py +++ b/zulip_bots/zulip_bots/lib.py @@ -56,8 +56,8 @@ class StateHandler(object): def __init__(self): # type: () -> None self.state_ = {} # type: Dict[Text, Text] - self.marshal = lambda obj: obj - self.demarshal = lambda obj: obj + self.marshal = lambda obj: json.dumps(obj) + self.demarshal = lambda obj: json.loads(obj) def put(self, key, value): # type: (Text, Text) -> None diff --git a/zulip_bots/zulip_bots/test_lib.py b/zulip_bots/zulip_bots/test_lib.py index 48dd05d..fea1e82 100755 --- a/zulip_bots/zulip_bots/test_lib.py +++ b/zulip_bots/zulip_bots/test_lib.py @@ -46,6 +46,8 @@ class BotTestCaseBase(TestCase): self.MockClass = self.patcher.start() self.mock_bot_handler = self.MockClass(None, None) self.mock_bot_handler.storage = StateHandler() + self.mock_bot_handler.send_message.return_value = {'id': 42} + self.mock_bot_handler.send_reply.return_value = {'id': 42} self.message_handler = self.get_bot_message_handler() def tearDown(self):