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