From 586938e13cce9b7d329a77b6bf08c8c41915bed1 Mon Sep 17 00:00:00 2001 From: Pieter Ennes Date: Sun, 3 Mar 2024 10:02:40 +0100 Subject: [PATCH] Add assertion on www-authenticate header. --- tests/test_security_openid_connect.py | 1 + tests/test_security_openid_connect_description.py | 1 + 2 files changed, 2 insertions(+) diff --git a/tests/test_security_openid_connect.py b/tests/test_security_openid_connect.py index 8a548e5c7..5d5d34a67 100644 --- a/tests/test_security_openid_connect.py +++ b/tests/test_security_openid_connect.py @@ -40,6 +40,7 @@ def test_security_oauth2_password_other_header(): def test_security_oauth2_password_bearer_no_header(): response = client.get("/users/me") assert response.status_code == 401, response.text + assert response.headers["WWW-Authenticate"] == "Bearer" assert response.json() == {"detail": "Not authenticated"} diff --git a/tests/test_security_openid_connect_description.py b/tests/test_security_openid_connect_description.py index dc4bc649a..24f10801f 100644 --- a/tests/test_security_openid_connect_description.py +++ b/tests/test_security_openid_connect_description.py @@ -42,6 +42,7 @@ def test_security_oauth2_password_other_header(): def test_security_oauth2_password_bearer_no_header(): response = client.get("/users/me") assert response.status_code == 401, response.text + assert response.headers["WWW-Authenticate"] == "Bearer" assert response.json() == {"detail": "Not authenticated"}