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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user