from app.storage.db import connect from app.storage.repositories import Repository def test_active_self_download_count(tmp_path): conn = connect(str(tmp_path / "state.db")) repo = Repository(conn) for i in range(8): repo.upsert_download(f"owner/model-{i}", "HUGGING_FACE", "RUNNING", "self", True) repo.upsert_download("owner/other", "HUGGING_FACE", "RUNNING", "others", False) assert repo.count_active_self_downloads() == 8 conn.close()