Fixing download config import issue.
Some checks are pending
CodeQL / Analyze (push) Waiting to run
Controller Tests / controller-tests (push) Waiting to run
Jest Tests / jest-tests (push) Waiting to run

This commit is contained in:
Roland 2025-12-16 19:59:28 -07:00
parent 630d06980a
commit 10d34d7390
No known key found for this signature in database
GPG key ID: 1BA620CE6C9A4680
3 changed files with 5 additions and 5 deletions

View file

@ -376,7 +376,7 @@ async def test_zim_subscription_download_import(async_client, test_session):
for _ in range(1): # Import twice.
# Importing the config restores the Download and ZimSubscription.
await import_downloads_config(test_session)
await import_downloads_config()
recurring, once = test_session.query(Download).order_by(Download.frequency)
assert once.url == 'https://download.kiwix.org/zim/wikibooks/wikibooks_en_all_maxi_2021-03.zim'
assert test_session.query(Download).count() == 2

View file

@ -1436,7 +1436,7 @@ def save_downloads_config():
save_downloads_config: ActivateSwitchMethod
async def import_downloads_config(session: Session):
async def import_downloads_config():
"""Upsert all Downloads in the Download Manager Config into the DB.
The config is the source of truth."""

View file

@ -415,7 +415,7 @@ async def test_crud_download(async_client, test_session, test_download_manager,
async def test_downloads_config(test_session, test_download_manager, test_download_manager_config,
test_downloader, assert_downloads, tag_factory, await_switches):
# Can import with an empty config.
await import_downloads_config(test_session)
await import_downloads_config()
assert_downloads([])
test_downloader.set_test_success()
@ -479,7 +479,7 @@ async def test_downloads_config(test_session, test_download_manager, test_downlo
get_download_manager_config().initialize()
# Import the saved downloads.
await import_downloads_config(test_session)
await import_downloads_config()
expected = [
dict(
url='https://example.com/2',
@ -504,7 +504,7 @@ async def test_downloads_config(test_session, test_download_manager, test_downlo
assert_downloads(expected)
# Import again, no duplicates.
await import_downloads_config(test_session)
await import_downloads_config()
assert_downloads(expected)