Make cookie-file auth env-only for multi-account use
All checks were successful
CI / test (3.11) (push) Successful in 55s
CI / test (3.10) (push) Successful in 1m58s
CI / test (3.12) (push) Successful in 1m0s

This commit is contained in:
2026-05-08 16:47:34 +02:00
parent bc82333e07
commit 4878d11b15
4 changed files with 8 additions and 18 deletions

View File

@@ -103,6 +103,7 @@ def test_load_from_cookie_file_parses_netscape_cookie_dump(tmp_path) -> None:
def test_get_cookies_uses_cookie_file_before_browser(monkeypatch) -> None:
monkeypatch.setattr(auth, "load_from_env", lambda: None)
monkeypatch.setenv("TWITTER_COOKIE_FILE", "/tmp/cookies.txt")
monkeypatch.setattr(
auth,
"load_from_cookie_file",
@@ -116,7 +117,7 @@ def test_get_cookies_uses_cookie_file_before_browser(monkeypatch) -> None:
lambda auth_token, ct0, cookie_string=None: seen.append((auth_token, ct0, cookie_string)) or {},
)
cookies = auth.get_cookies({"auth": {"cookieFile": "/tmp/cookies.txt"}})
cookies = auth.get_cookies()
assert cookies["auth_token"] == "file-token"
assert seen == [("file-token", "file-csrf", "a=1")]