mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 21:13:36 +00:00
users: Get all API keys via wrapper method.
Now reading API keys from a user is done with the get_api_key wrapper method, rather than directly fetching it from the user object. Also, every place where an action should be done for each API key is now using get_all_api_keys. This method returns for the moment a single-item list, containing the specified user's API key. This commit is the first step towards allowing users have multiple API keys.
This commit is contained in:
committed by
Tim Abbott
parent
13b9dd33fa
commit
f6219745de
@@ -36,6 +36,7 @@ from zerver.lib.actions import (
|
||||
)
|
||||
from zerver.lib.create_user import copy_user_settings
|
||||
from zerver.lib.request import JsonableError
|
||||
from zerver.lib.users import get_api_key
|
||||
from zerver.views.upload import upload_file_backend, serve_local
|
||||
|
||||
import urllib
|
||||
@@ -115,7 +116,7 @@ class FileUploadTest(UploadSerializeMixin, ZulipTestCase):
|
||||
response = self.client_get(uri + "?api_key=" + "invalid")
|
||||
self.assertEqual(response.status_code, 400)
|
||||
|
||||
response = self.client_get(uri + "?api_key=" + user_profile.api_key)
|
||||
response = self.client_get(uri + "?api_key=" + get_api_key(user_profile))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
data = b"".join(response.streaming_content)
|
||||
self.assertEqual(b"zulip!", data)
|
||||
|
||||
Reference in New Issue
Block a user