fix(auth): hoist _build_google_auth import to module level for ty compatibility

This commit is contained in:
Jacob Magar
2026-03-16 10:37:36 -04:00
parent 4a1ffcfd51
commit 1248ccd53e

View File

@@ -3,6 +3,8 @@
import importlib
from unittest.mock import MagicMock, patch
from unraid_mcp.server import _build_google_auth
def test_build_google_auth_returns_none_when_unconfigured(monkeypatch):
"""Returns None when Google OAuth env vars are absent."""
@@ -14,8 +16,6 @@ def test_build_google_auth_returns_none_when_unconfigured(monkeypatch):
importlib.reload(s)
from unraid_mcp.server import _build_google_auth
result = _build_google_auth()
assert result is None
@@ -35,8 +35,6 @@ def test_build_google_auth_returns_provider_when_configured(monkeypatch):
mock_provider_class = MagicMock(return_value=mock_provider)
with patch("unraid_mcp.server.GoogleProvider", mock_provider_class):
from unraid_mcp.server import _build_google_auth
result = _build_google_auth()
assert result is mock_provider
@@ -62,8 +60,6 @@ def test_build_google_auth_omits_jwt_key_when_empty(monkeypatch):
mock_provider_class = MagicMock(return_value=MagicMock())
with patch("unraid_mcp.server.GoogleProvider", mock_provider_class):
from unraid_mcp.server import _build_google_auth
_build_google_auth()
call_kwargs = mock_provider_class.call_args.kwargs
@@ -83,8 +79,6 @@ def test_build_google_auth_warns_on_stdio_transport(monkeypatch):
warning_messages: list[str] = []
from unraid_mcp.server import _build_google_auth
with (
patch("unraid_mcp.server.GoogleProvider", MagicMock(return_value=MagicMock())),
patch("unraid_mcp.server.logger") as mock_logger,