Download tests/test_sanitize.py from smlflg/agent-process-dashboard: direct link, hf CLI and curl.
- Browser
- Download file 813 Bytes
-
https://huggingface.co/smlflg/agent-process-dashboard/resolve/main/tests/test_sanitize.py
- Command line
-
hf download hf://smlflg/agent-process-dashboard/tests/test_sanitize.py
-
curl -L -o test_sanitize.py https://huggingface.co/smlflg/agent-process-dashboard/resolve/main/tests/test_sanitize.py
813 Bytes
| from agent_process_dashboard.sanitize import render_argv, sanitize_argv | |
| def test_sanitize_flags_equals_urls_and_token_shapes(): | |
| argv, masked = sanitize_argv( | |
| [ | |
| "cmd", | |
| "--api-key", | |
| "sk-abcdefghijklmnopqrstuvwxyz", | |
| "--token=plain", | |
| "OPENAI_SECRET=abc", | |
| "https://user:pass@example.com/path?token=abc&ok=1", | |
| ] | |
| ) | |
| assert argv[2] == "<redacted>" | |
| assert argv[3] == "--token=<redacted>" | |
| assert argv[4] == "OPENAI_SECRET=<redacted>" | |
| assert "token=%3Credacted%3E" in argv[5] | |
| assert "<redacted>@example.com" in argv[5] | |
| assert masked == 4 | |
| def test_render_argv_truncates(): | |
| rendered = render_argv(("cmd", "x" * 400), max_len=20) | |
| assert rendered.endswith("...") | |
| assert len(rendered) == 20 | |