mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-30 20:06:22 -05:00
Refactoring ArchiveDownloader so that it is more testable.
This commit is contained in:
parent
0a2e343201
commit
39bd25acfe
6 changed files with 433 additions and 109 deletions
|
|
@ -1185,8 +1185,12 @@ async def test_archive_download_uses_domain_collection_directory(async_client, t
|
|||
test_session.add(download)
|
||||
test_session.commit()
|
||||
|
||||
# Call the archive downloader
|
||||
result = await archive_downloader.do_download(download)
|
||||
# Drive the phase-split API directly: prepare → execute → finalize.
|
||||
from modules.archive.conftest import make_test_ctx
|
||||
prepared = archive_downloader.prepare_download(test_session, download)
|
||||
executed = await archive_downloader.execute_download(prepared, make_test_ctx())
|
||||
result = archive_downloader.finalize_download(test_session, download, executed)
|
||||
test_session.commit()
|
||||
|
||||
# Verify the download was successful
|
||||
assert result.success is True
|
||||
|
|
@ -1247,8 +1251,12 @@ async def test_archive_download_explicit_destination_overrides_domain_collection
|
|||
test_session.add(download)
|
||||
test_session.commit()
|
||||
|
||||
# Call the archive downloader
|
||||
result = await archive_downloader.do_download(download)
|
||||
# Drive the phase-split API directly: prepare → execute → finalize.
|
||||
from modules.archive.conftest import make_test_ctx
|
||||
prepared = archive_downloader.prepare_download(test_session, download)
|
||||
executed = await archive_downloader.execute_download(prepared, make_test_ctx())
|
||||
result = archive_downloader.finalize_download(test_session, download, executed)
|
||||
test_session.commit()
|
||||
|
||||
# Verify the download was successful
|
||||
assert result.success is True
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue