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
This commit is contained in:
copilot-swe-agent[bot]
2026-03-23 22:56:54 +00:00
parent c9bb2b6807
commit 2f5e2a0fcd
+4 -4
View File
@@ -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