mirror of
https://github.com/zulip/zulip.git
synced 2025-10-31 20:13:46 +00:00
test_scim: Add test for missing or wrong authentication.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
cba8738eea
commit
7e8ebd18b6
@@ -114,6 +114,19 @@ class TestExceptionDetailsNotRevealedToClient(SCIMTestCase):
|
||||
|
||||
|
||||
class TestSCIMUser(SCIMTestCase):
|
||||
def test_bad_authentication(self) -> None:
|
||||
hamlet = self.example_user("hamlet")
|
||||
|
||||
result = self.client_get(f"/scim/v2/Users/{hamlet.id}", {})
|
||||
self.assertEqual(result.status_code, 401)
|
||||
self.assertEqual(result.headers["WWW-Authenticate"], 'Basic realm="django-scim2"')
|
||||
|
||||
result = self.client_get(
|
||||
f"/scim/v2/Users/{hamlet.id}", {"HTTP_AUTHORIZATION": "Bearer wrong"}
|
||||
)
|
||||
self.assertEqual(result.status_code, 401)
|
||||
self.assertEqual(result.headers["WWW-Authenticate"], 'Basic realm="django-scim2"')
|
||||
|
||||
def test_get_by_id(self) -> None:
|
||||
hamlet = self.example_user("hamlet")
|
||||
expected_response_schema = self.generate_user_schema(hamlet)
|
||||
|
||||
Reference in New Issue
Block a user