"Vibe-Trading: Your Personal Trading Agent"
Python ai-agentalgorithmic-tradingbacktestingfintechllmmcpmulti-agentpythonquantitative-financetrading
fix(tests): make oauth token cache permission checks portable
Mirandab84518066c65
diff --git a/agent/tests/test_oauth_token_cache.py b/agent/tests/test_oauth_token_cache.pyindex 5fc5b22b9..dd7de6537 100644--- a/agent/tests/test_oauth_token_cache.py+++ b/agent/tests/test_oauth_token_cache.py@@ -26,21 +26,28 @@ from src.tools.mcp import _build_token_storepytestmark = pytest.mark.unit+def _assert_owner_only_mode_on_posix(cache: Path) -> None:+ assert cache.is_dir()+ if os.name == "nt":+ return+ mode = stat.S_IMODE(os.stat(cache).st_mode)+ assert mode == 0o700, f"expected owner-only 0700, got {oct(mode)}"++def test_build_token_store_creates_dir_0700(tmp_path: Path) -> None:cache = tmp_path / "oauth"assert not cache.exists()_build_token_store(str(cache))- assert cache.is_dir()- mode = stat.S_IMODE(os.stat(cache).st_mode)- assert mode == 0o700, f"expected owner-only 0700, got {oct(mode)}"+ _assert_owner_only_mode_on_posix(cache)def test_build_token_store_expands_user(monkeypatch, tmp_path: Path) -> None:fake_home = tmp_path / "home"fake_home.mkdir()monkeypatch.setenv("HOME", str(fake_home))+ monkeypatch.setenv("USERPROFILE", str(fake_home))_build_token_store("~/.vibe-trading/live/robinhood/oauth")@@ -53,7 +60,7 @@ def test_build_token_store_idempotent_on_existing_dir(tmp_path: Path) -> None:_build_token_store(str(cache))# Second call must not raise on an already-existing directory._build_token_store(str(cache))- assert stat.S_IMODE(os.stat(cache).st_mode) == 0o700+ _assert_owner_only_mode_on_posix(cache)def test_token_persists_across_store_instances(tmp_path: Path) -> None: