20 lines
597 B
Python
20 lines
597 B
Python
from pathlib import Path
|
|
|
|
from pyxray.xray.downloader import DownloadManager
|
|
from pyxray.xray.models import DownloadKind, DownloadRequest, DownloadState
|
|
|
|
|
|
def test_download_manager_starts_single_running_task(tmp_path) -> None:
|
|
manager = DownloadManager(tmp_path)
|
|
request = DownloadRequest(
|
|
kind=DownloadKind.GEOIP,
|
|
url="https://example.invalid/geoip.dat",
|
|
target=Path(tmp_path / "geoip.dat"),
|
|
)
|
|
|
|
first = manager.start(request)
|
|
second = manager.start(request)
|
|
|
|
assert first.state == DownloadState.RUNNING
|
|
assert second.kind == DownloadKind.GEOIP
|