From cafc0e45230ffea096664c1947ac20753b63f8e9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 24 Mar 2026 18:09:54 +0000 Subject: [PATCH] fix(tests): add admin override fixture to TestSaveDropboxSettings Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com> Agent-Logs-Url: https://github.com/christianlouis/DocuElevate/sessions/916d85bf-aa2d-48bb-ad46-2672a641d6fe --- tests/test_api_dropbox.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_api_dropbox.py b/tests/test_api_dropbox.py index 71139d7b..ac50610d 100644 --- a/tests/test_api_dropbox.py +++ b/tests/test_api_dropbox.py @@ -267,6 +267,15 @@ class TestTestDropboxToken: class TestSaveDropboxSettings: """Tests for save_dropbox_settings endpoint.""" + @pytest.fixture(autouse=True) + def _admin_override(self): + from app.api.dropbox import _require_admin + from app.main import app as fastapi_app + + fastapi_app.dependency_overrides[_require_admin] = lambda: {"is_admin": True} + yield + fastapi_app.dependency_overrides.pop(_require_admin, None) + @patch("app.api.dropbox.settings") def test_save_settings_env_not_found(self, mock_settings, client): """Test that missing .env file is non-fatal — DB write still succeeds."""