Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Download tests/test_api/test_codex_terminal_login_parse.py from DanielKretschmer/lighting-mvp: direct link, hf CLI and curl.
- Browser
- Download file 2.14 kB
-
https://huggingface.co/spaces/DanielKretschmer/lighting-mvp/resolve/main/tests/test_api/test_codex_terminal_login_parse.py
- Command line
-
hf download hf://spaces/DanielKretschmer/lighting-mvp/tests/test_api/test_codex_terminal_login_parse.py
-
curl -L -o test_codex_terminal_login_parse.py https://huggingface.co/spaces/DanielKretschmer/lighting-mvp/resolve/main/tests/test_api/test_codex_terminal_login_parse.py
2.14 kB
| from app.api.routes import admin | |
| def test_extract_codex_login_controls_finds_url_and_device_code(): | |
| output = """ | |
| To sign in, open this URL in your browser: | |
| https://auth.openai.com/oauth/device?user_code=ABCD-EFGH&client_id=codex | |
| Then enter code ABCD-EFGH to continue. | |
| """ | |
| assert admin._extract_codex_login_controls(output) == { | |
| "url": "https://auth.openai.com/oauth/device?user_code=ABCD-EFGH&client_id=codex", | |
| "device_code": "ABCD-EFGH", | |
| } | |
| def test_extract_codex_login_controls_tolerates_wrapped_url_and_spaced_code(): | |
| output = ( | |
| "Visit https://auth.openai.com/oauth/device?client_id=codex&\r\n" | |
| "scope=device to authenticate.\n" | |
| "Your code is WXYZ 1234.\n" | |
| ) | |
| assert admin._extract_codex_login_controls(output) == { | |
| "url": "https://auth.openai.com/oauth/device?client_id=codex&scope=device", | |
| "device_code": "WXYZ-1234", | |
| } | |
| def test_extract_codex_login_controls_handles_current_codex_device_auth_output(): | |
| output = """ | |
| Follow these steps to sign in with ChatGPT using device code authorization: | |
| 1. Open this link in your browser and sign in to your account | |
| https://auth.openai.com/codex/device | |
| 2. Enter this one-time code (expires in 15 minutes) | |
| 8K9E-GF4JV | |
| Device codes are a common phishing target. Never share this code. | |
| """ | |
| assert admin._extract_codex_login_controls(output) == { | |
| "url": "https://auth.openai.com/codex/device", | |
| "device_code": "8K9E-GF4JV", | |
| } | |
| def test_extract_codex_login_controls_handles_codex_0142_screenshot_output(): | |
| output = """ | |
| Welcome to Codex [v0.142.0] | |
| OpenAI's command-line coding agent | |
| Follow these steps to sign in with ChatGPT using device code authorization: | |
| 1. Open this link in your browser and sign in to your account | |
| https://auth.openai.com/codex/device | |
| 2. Enter this one-time code (expires in 15 minutes) | |
| 8KXX-CDQAS | |
| """ | |
| assert admin._extract_codex_login_controls(output) == { | |
| "url": "https://auth.openai.com/codex/device", | |
| "device_code": "8KXX-CDQAS", | |
| } | |