Download tests/test_registration_route_helpers.py from webhook/codex: direct link, hf CLI and curl.
- Browser
- Download file 1.2 kB
-
https://huggingface.co/spaces/webhook/codex/resolve/main/tests/test_registration_route_helpers.py
- Command line
-
hf download hf://spaces/webhook/codex/tests/test_registration_route_helpers.py
-
curl -L -o test_registration_route_helpers.py https://huggingface.co/spaces/webhook/codex/resolve/main/tests/test_registration_route_helpers.py
1.2 kB
| from src.config.constants import EmailServiceType | |
| from src.web.routes.registration import _resolve_proxy_for_service | |
| def test_temp_mail_without_explicit_proxy_stays_direct(monkeypatch): | |
| def unexpected_proxy_lookup(_db): | |
| raise AssertionError("auto proxy lookup should not run for temp_mail") | |
| monkeypatch.setattr( | |
| "src.web.routes.registration.get_proxy_for_registration", | |
| unexpected_proxy_lookup, | |
| ) | |
| proxy_url, proxy_id, proxy_source = _resolve_proxy_for_service( | |
| db=None, | |
| service_type=EmailServiceType.TEMP_MAIL, | |
| explicit_proxy=None, | |
| ) | |
| assert proxy_url is None | |
| assert proxy_id is None | |
| assert proxy_source == "direct" | |
| def test_non_temp_mail_without_explicit_proxy_uses_auto_proxy(monkeypatch): | |
| monkeypatch.setattr( | |
| "src.web.routes.registration.get_proxy_for_registration", | |
| lambda _db: ("http://auto-proxy:8080", 7), | |
| ) | |
| proxy_url, proxy_id, proxy_source = _resolve_proxy_for_service( | |
| db=None, | |
| service_type=EmailServiceType.TEMPMAIL, | |
| explicit_proxy=None, | |
| ) | |
| assert proxy_url == "http://auto-proxy:8080" | |
| assert proxy_id == 7 | |
| assert proxy_source == "auto" | |