Skip to content

AI agent skill that researches any topic across Reddit, X, YouTube, HN, Polymarket, and the web - then synthesizes a grounded summary

fix(tests): patch env isolation in test_api_key_takes_priority

Matt Van Horn04bfb5381d8e
diff --git a/tests/test_codex_auth.py b/tests/test_codex_auth.py
index 5634de03..595971e5 100644
--- a/tests/test_codex_auth.py
+++ b/tests/test_codex_auth.py
@@ -74,8 +74,9 @@ class TestExtractChatgptAccountId(unittest.TestCase):
class TestGetOpenaiAuth(unittest.TestCase):
+ @patch.dict(os.environ, {}, clear=True)
def test_api_key_takes_priority(self):
- """OPENAI_API_KEY in env file should be preferred over Codex."""
+ """OPENAI_API_KEY in env file is used when env var is not set."""
file_env = {"OPENAI_API_KEY": "sk-test123"}
auth = env.get_openai_auth(file_env)
self.assertEqual(auth.source, "api_key")