fix: merge main, resolve conflicts, address review feedback
- Resolve merge conflicts in app/api/onedrive.py and tests/test_api_google_drive_final.py - Fix legacy Dict[str, str] type hints in update_env_file functions to use dict[str, str] - Add admin-only access (_require_admin dependency) to save-settings endpoints in google_drive.py, onedrive.py, and dropbox.py - Fix in_memory_only response field to reflect actual env_write_success status - Update tests to override _require_admin dependency for save-settings endpoint tests
This commit is contained in:
@@ -154,6 +154,15 @@ class TestGetTokenInfoCredentialsBranches:
|
||||
class TestSaveGoogleDriveSettingsFalsyFields:
|
||||
"""Cover branches 395->397, 449->451, 468->470 in save_google_drive_settings."""
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _admin_override(self):
|
||||
from app.api.google_drive 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.google_drive.settings")
|
||||
@patch("os.path.exists", return_value=False)
|
||||
@pytest.mark.asyncio
|
||||
@@ -173,6 +182,7 @@ class TestSaveGoogleDriveSettingsFalsyFields:
|
||||
with patch("app.api.google_drive.notify_settings_updated"):
|
||||
result = await save_google_drive_settings(
|
||||
request=mock_request,
|
||||
_admin={"is_admin": True},
|
||||
refresh_token="", # falsy → branches 395->397 and 449->451
|
||||
client_id="cid",
|
||||
client_secret=None,
|
||||
|
||||
Reference in New Issue
Block a user