fix(tests): fix test_save_settings_outer_exception in OneDrive coverage tests

The test was patching os.path.join, which is called inside an inner
try/except block in save_onedrive_settings. This meant the exception
was silently caught and logged, never reaching the outer exception
handler that returns HTTP 500.

Fix by patching notify_settings_updated instead, which is called in
the outer try block, so exceptions correctly propagate to the outer
handler.

Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-02-26 11:02:16 +00:00
parent 28e3d1e2d5
commit b4e93c00b4
+1 -1
View File
@@ -296,7 +296,7 @@ class TestSaveSettingsException:
def test_save_settings_outer_exception(self, client: TestClient):
"""Trigger the outer exception handler in save_onedrive_settings."""
with patch("app.api.onedrive.os.path.join", side_effect=Exception("Unexpected boom")):
with patch("app.api.onedrive.notify_settings_updated", side_effect=Exception("Unexpected boom")):
response = client.post(
"/api/onedrive/save-settings",
data={