mirror of
https://github.com/zulip/zulip.git
synced 2026-07-15 21:03:26 +08:00
test_slack_importer: Fix mocked_requests_get type.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
4b44d87477
commit
a236256d64
@ -63,16 +63,16 @@ def remove_folder(path: str) -> None:
|
||||
if os.path.exists(path):
|
||||
shutil.rmtree(path)
|
||||
|
||||
class MockResponse:
|
||||
def __init__(self, json_data: Dict[str, Any], status_code: int) -> None:
|
||||
self.json_data = json_data
|
||||
self.status_code = status_code
|
||||
|
||||
def json(self) -> Dict[str, Any]:
|
||||
return self.json_data
|
||||
|
||||
# This method will be used by the mock to replace requests.get
|
||||
def mocked_requests_get(*args: List[str], **kwargs: List[str]) -> mock.Mock:
|
||||
class MockResponse:
|
||||
def __init__(self, json_data: Dict[str, Any], status_code: int) -> None:
|
||||
self.json_data = json_data
|
||||
self.status_code = status_code
|
||||
|
||||
def json(self) -> Dict[str, Any]:
|
||||
return self.json_data
|
||||
|
||||
def mocked_requests_get(*args: List[str], **kwargs: List[str]) -> MockResponse:
|
||||
if args[0] == 'https://slack.com/api/users.list?token=xoxp-valid-token':
|
||||
return MockResponse({"ok": True, "members": "user_data"}, 200)
|
||||
elif args[0] == 'https://slack.com/api/users.list?token=xoxp-invalid-token':
|
||||
|
||||
Loading…
Reference in New Issue
Block a user