zulip_bots: Fix get_storage request arguments in StateHandler.
MODIFY
zulip/zulip/__init__.py
zulip/zulip/__init__.py
@@ -1006,7 +1006,7 @@ class Client(object):
>>> client.update_storage({'storage': {"entry 1": "value 1", "entry 2": "value 2", "entry 3": "value 3"}})
>>> client.get_storage()
{'result': 'success', 'storage': {"entry 1": "value 1", "entry 2": "value 2", "entry 3": "value 3"}, 'msg': ''}
- >>> client.get_storage(keys=('entry 1', 'entry 3'))
+ >>> client.get_storage({'keys': ["entry 1", "entry 3"]})
{'result': 'success', 'storage': {'entry 1': 'value 1', 'entry 3': 'value 3'}, 'msg': ''}
'''
return self.call_endpoint(

MODIFY
zulip_bots/zulip_bots/lib.py
zulip_bots/zulip_bots/lib.py
@@ -69,7 +69,7 @@ class StateHandler(object):
if key in self.state_:
return self.demarshal(self.state_[key])
- response = self._client.get_storage(keys=(key,))
+ response = self._client.get_storage({'keys': [key]})
if response['result'] != 'success':
raise StateHandlerError("Error fetching state: {}".format(str(response)))

MODIFY
zulip_bots/zulip_bots/tests/test_lib.py
zulip_bots/zulip_bots/tests/test_lib.py
@@ -27,7 +27,7 @@ class FakeClient:
result='success',
)
- def get_storage(self, keys):
+ def get_storage(self, request):
return dict(
result='success',
storage=self.storage,
@@ -97,7 +97,7 @@ class LibTest(TestCase):
result='success',
storage=dict(non_cached_key='[5]')))
val = state_handler.get('non_cached_key')
- client.get_storage.assert_called_with(keys=('non_cached_key',))
+ client.get_storage.assert_called_with({'keys': ['non_cached_key']})
self.assertEqual(val, [5])
# value must already be cached

zulip_bots: Fix get_storage request arguments in StateHandler.