zulip_bots: Fix get_storage request arguments in StateHandler.
This commit is contained in:
parent
88b649d689
commit
918e63a220
|
@ -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(
|
||||
|
|
|
@ -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)))
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue