forked from HomeLab/unraid-mcp
fix(auth): hoist _build_google_auth import to module level for ty compatibility
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
import importlib
|
import importlib
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
|
from unraid_mcp.server import _build_google_auth
|
||||||
|
|
||||||
|
|
||||||
def test_build_google_auth_returns_none_when_unconfigured(monkeypatch):
|
def test_build_google_auth_returns_none_when_unconfigured(monkeypatch):
|
||||||
"""Returns None when Google OAuth env vars are absent."""
|
"""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)
|
importlib.reload(s)
|
||||||
|
|
||||||
from unraid_mcp.server import _build_google_auth
|
|
||||||
|
|
||||||
result = _build_google_auth()
|
result = _build_google_auth()
|
||||||
assert result is None
|
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)
|
mock_provider_class = MagicMock(return_value=mock_provider)
|
||||||
|
|
||||||
with patch("unraid_mcp.server.GoogleProvider", mock_provider_class):
|
with patch("unraid_mcp.server.GoogleProvider", mock_provider_class):
|
||||||
from unraid_mcp.server import _build_google_auth
|
|
||||||
|
|
||||||
result = _build_google_auth()
|
result = _build_google_auth()
|
||||||
|
|
||||||
assert result is mock_provider
|
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())
|
mock_provider_class = MagicMock(return_value=MagicMock())
|
||||||
|
|
||||||
with patch("unraid_mcp.server.GoogleProvider", mock_provider_class):
|
with patch("unraid_mcp.server.GoogleProvider", mock_provider_class):
|
||||||
from unraid_mcp.server import _build_google_auth
|
|
||||||
|
|
||||||
_build_google_auth()
|
_build_google_auth()
|
||||||
|
|
||||||
call_kwargs = mock_provider_class.call_args.kwargs
|
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] = []
|
warning_messages: list[str] = []
|
||||||
|
|
||||||
from unraid_mcp.server import _build_google_auth
|
|
||||||
|
|
||||||
with (
|
with (
|
||||||
patch("unraid_mcp.server.GoogleProvider", MagicMock(return_value=MagicMock())),
|
patch("unraid_mcp.server.GoogleProvider", MagicMock(return_value=MagicMock())),
|
||||||
patch("unraid_mcp.server.logger") as mock_logger,
|
patch("unraid_mcp.server.logger") as mock_logger,
|
||||||
|
|||||||
Reference in New Issue
Block a user