From 2f5e2a0fcdd9f9532fc55c6d7ce1675b8be3d3e8 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 23 Mar 2026 22:56:54 +0000 Subject: [PATCH] test(google_drive): fix exception handling test to expect non-fatal 200 like OneDrive equivalent Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com> Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/c07ba712-5bf3-4083-8234-53224a59f4ba --- tests/test_api_google_drive_comprehensive.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_api_google_drive_comprehensive.py b/tests/test_api_google_drive_comprehensive.py index 6275602f..abd54707 100644 --- a/tests/test_api_google_drive_comprehensive.py +++ b/tests/test_api_google_drive_comprehensive.py @@ -494,14 +494,14 @@ class TestSaveGoogleDriveSettings: @patch("os.path.dirname") @patch("app.config.settings") def test_save_settings_exception_handling(self, mock_settings, mock_dirname, mock_exists, client: TestClient): - """Test exception handling in save settings.""" + """Test that exceptions in .env write are non-fatal — DB write still succeeds.""" mock_exists.side_effect = Exception("Unexpected error") response = client.post("/api/google-drive/save-settings", data={"refresh_token": "token", "use_oauth": "true"}) - assert response.status_code == 500 - data = response.json() - assert "failed to save" in data["detail"].lower() + # .env write exception is caught; endpoint succeeds via DB write + assert response.status_code == 200 + assert response.json()["status"] == "success" @pytest.mark.unit