diff --git a/app/api/integrations.py b/app/api/integrations.py index 9261e1a6..c0d58893 100644 --- a/app/api/integrations.py +++ b/app/api/integrations.py @@ -46,6 +46,7 @@ except ImportError: # pragma: no cover class _DropboxBadInputError(Exception): # type: ignore[no-redef] """Stub — only used when the dropbox package is missing.""" + logger = logging.getLogger(__name__) router = APIRouter(prefix="/integrations", tags=["integrations"]) @@ -593,7 +594,10 @@ def _test_dropbox_connection(config: dict[str, Any] | None, credentials: dict[st return {"success": True, "message": f"Dropbox connection successful{name_str}"} except _DropboxAuthError as exc: logger.warning("Dropbox auth error: %s", exc) - return {"success": False, "message": "Dropbox authentication failed — check app_key, app_secret, and refresh_token"} + return { + "success": False, + "message": "Dropbox authentication failed — check app_key, app_secret, and refresh_token", + } except _DropboxBadInputError as exc: logger.warning("Dropbox bad input error: %s", exc) return {"success": False, "message": "Dropbox connection failed — invalid credentials format"} diff --git a/tests/test_api_integrations.py b/tests/test_api_integrations.py index df67a71d..45336b2d 100644 --- a/tests/test_api_integrations.py +++ b/tests/test_api_integrations.py @@ -932,9 +932,7 @@ class TestConnectionTestEndpoint: with patch("app.api.integrations.dbx_lib") as mock_dbx: mock_instance = MagicMock() mock_dbx.Dropbox.return_value = mock_instance - mock_instance.users_get_current_account.side_effect = dbx_exc.AuthError( - "req_id", MagicMock() - ) + mock_instance.users_get_current_account.side_effect = dbx_exc.AuthError("req_id", MagicMock()) payload = { "integration_type": "DROPBOX", "config": {},