mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
test_classes: Give useful error when using /json/ URLs wrong.
This commit is contained in:
@@ -1074,6 +1074,7 @@ Output:
|
||||
def api_get(
|
||||
self, user: UserProfile, url: str, info: Mapping[str, Any] = {}, **extra: str
|
||||
) -> "TestHttpResponse":
|
||||
assert not url.startswith("/json/"), "Invalid URL for API authentication"
|
||||
extra["HTTP_AUTHORIZATION"] = self.encode_user(user)
|
||||
return self.client_get(
|
||||
url,
|
||||
@@ -1096,6 +1097,7 @@ Output:
|
||||
intentionally_undocumented: bool = False,
|
||||
**extra: str,
|
||||
) -> "TestHttpResponse":
|
||||
assert not url.startswith("/json/"), "Invalid URL for API authentication"
|
||||
extra["HTTP_AUTHORIZATION"] = self.encode_user(user)
|
||||
return self.client_post(
|
||||
url,
|
||||
@@ -1112,6 +1114,7 @@ Output:
|
||||
def api_patch(
|
||||
self, user: UserProfile, url: str, info: Mapping[str, Any] = {}, **extra: str
|
||||
) -> "TestHttpResponse":
|
||||
assert not url.startswith("/json/"), "Invalid URL for API authentication"
|
||||
extra["HTTP_AUTHORIZATION"] = self.encode_user(user)
|
||||
return self.client_patch(
|
||||
url,
|
||||
@@ -1128,6 +1131,7 @@ Output:
|
||||
def api_delete(
|
||||
self, user: UserProfile, url: str, info: Mapping[str, Any] = {}, **extra: str
|
||||
) -> "TestHttpResponse":
|
||||
assert not url.startswith("/json/"), "Invalid URL for API authentication"
|
||||
extra["HTTP_AUTHORIZATION"] = self.encode_user(user)
|
||||
return self.client_delete(
|
||||
url,
|
||||
|
Reference in New Issue
Block a user