Skip to content

Commit 486bbe6

Browse files
committed
test: accept 422 invalid-user for synthetic context_user_id
Correcting the DefaultApi auth key means the request now authenticates and reaches user validation, which returns 422 for the made-up context_user_id (previously the wrong auth key returned 401). Accept 422 alongside the other expected statuses.
1 parent 823ad2e commit 486bbe6

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

tests/test_sso_integration.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ def test_get_comments_with_default_api(self, default_api, mock_secure_user):
132132

133133
except Exception as error:
134134
if hasattr(error, "status"):
135-
assert error.status in [404, 401, 403], f"Unexpected error status: {error.status}"
135+
# 422: the synthetic context_user_id is not a real user
136+
# (invalid-user). Reaching that validation confirms the API key
137+
# authenticated successfully.
138+
assert error.status in [404, 401, 403, 422], f"Unexpected error status: {error.status}"
136139
else:
137140
pytest.skip(f"API method signature may need updating: {str(error)}")
138141

0 commit comments

Comments
 (0)