bots: Make StateHandler store state on Zulip server.

This makes the StateHandler functional. To reduce the
number of server roundtrips when fetching/updating the
state, the entire state is fetched ocne at bot
initialization and cached. All changes are stored in the
cache and only saved externally after handle_message()
has been executed.

Fixes #141.
This commit is contained in:
derAnfaenger 2017-11-01 13:26:20 +01:00 committed by showell
parent 979bbb1c14
commit 2736223073
3 changed files with 32 additions and 8 deletions

View file

@ -39,8 +39,9 @@ class BotServerTests(BotServerTestCase):
check_success=False)
@mock.patch('logging.error')
def test_wrong_bot_credentials(self, mock_LoggingError):
# type: (mock.Mock) -> None
@mock.patch('zulip_bots.lib.StateHandler')
def test_wrong_bot_credentials(self, mock_StateHandler, mock_LoggingError):
# type: (mock.Mock, mock.Mock) -> None
available_bots = ['nonexistent-bot']
bots_config = {
'nonexistent-bot': {