diff --git a/zerver/tests/test_service_bot_system.py b/zerver/tests/test_service_bot_system.py index 6978640246..eba9854448 100644 --- a/zerver/tests/test_service_bot_system.py +++ b/zerver/tests/test_service_bot_system.py @@ -299,7 +299,7 @@ class TestServiceBotStateHandler(ZulipTestCase): 'storage': ujson.dumps({'foo': [1, 2, 3]}), } result = self.client_put('/json/bot_storage', params) - self.assert_json_error(result, "Value type is , but should be str.") + self.assert_json_error(result, "storage contains a value that is not a string") # Remove some entries. keys_to_remove = ['key 1', 'key 2'] diff --git a/zerver/views/storage.py b/zerver/views/storage.py index 3772345cc0..1a8e959531 100644 --- a/zerver/views/storage.py +++ b/zerver/views/storage.py @@ -16,11 +16,13 @@ from zerver.models import UserProfile @has_request_variables -def update_storage(request: HttpRequest, user_profile: UserProfile, - storage: Dict[str, str]=REQ(validator=check_dict([]))) -> HttpResponse: +def update_storage( + request: HttpRequest, user_profile: UserProfile, + storage: Dict[str, str]=REQ(validator=check_dict([], value_validator=check_string)), +) -> HttpResponse: try: set_bot_storage(user_profile, list(storage.items())) - except StateError as e: + except StateError as e: # nocoverage return json_error(str(e)) return json_success()