Download tests/test_router_security.py from RYUK999/TeleSave: direct link, hf CLI and curl.
- Browser
- Download file 726 Bytes
-
https://huggingface.co/spaces/RYUK999/TeleSave/resolve/main/tests/test_router_security.py
- Command line
-
hf download hf://spaces/RYUK999/TeleSave/tests/test_router_security.py
-
curl -L -o test_router_security.py https://huggingface.co/spaces/RYUK999/TeleSave/resolve/main/tests/test_router_security.py
726 Bytes
| import asyncio | |
| from pathlib import Path | |
| import pytest | |
| from pydantic import SecretStr | |
| from telesave.config import Settings | |
| from telesave.core.errors import UnsafeUrlError | |
| from telesave.downloaders.router import DownloaderRouter | |
| def _settings(tmp_path: Path) -> Settings: | |
| return Settings(BOT_TOKEN=SecretStr("123:test"), APP_ENV="test", TEMP_DIR=tmp_path) | |
| def test_router_rejects_private_urls_before_ytdlp(url: str, tmp_path: Path) -> None: | |
| router = DownloaderRouter(_settings(tmp_path), tmp_path) | |
| with pytest.raises(UnsafeUrlError): | |
| asyncio.run(router.download(url)) | |