fix(backend): Refactor OIDC callback and auth dependency to correctly handle cookies and prefix all API routes with /api/v1.

This commit is contained in:
Yunxiao Xu
2026-02-12 01:26:28 -08:00
parent 49a9da7c0c
commit 0dfdef738d
6 changed files with 51 additions and 29 deletions

View File

@@ -35,7 +35,7 @@ def test_get_conversations_success(auth_header, mock_user):
)
]
response = client.get("/conversations", headers=auth_header)
response = client.get("/api/v1/conversations", headers=auth_header)
assert response.status_code == 200
assert len(response.json()) == 1
@@ -53,7 +53,7 @@ def test_create_conversation_success(auth_header, mock_user):
)
response = client.post(
"/conversations",
"/api/v1/conversations",
json={"name": "New Conv"},
headers=auth_header
)
@@ -75,7 +75,7 @@ def test_get_messages_success(auth_header):
)
]
response = client.get("/conversations/c1/messages", headers=auth_header)
response = client.get("/api/v1/conversations/c1/messages", headers=auth_header)
assert response.status_code == 200
assert len(response.json()) == 1
@@ -86,7 +86,7 @@ def test_delete_conversation_success(auth_header):
with patch("ea_chatbot.api.routers.history.history_manager") as mock_hm:
mock_hm.delete_conversation.return_value = True
response = client.delete("/conversations/c1", headers=auth_header)
response = client.delete("/api/v1/conversations/c1", headers=auth_header)
assert response.status_code == 204
def test_get_plot_success(auth_header, mock_user):
@@ -109,7 +109,7 @@ def test_get_plot_success(auth_header, mock_user):
mock_session.get.side_effect = mock_get
response = client.get("/artifacts/plots/p1", headers=auth_header)
response = client.get("/api/v1/artifacts/plots/p1", headers=auth_header)
assert response.status_code == 200
assert response.content == b"fake-image-data"