-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0296795
commit cfa991f
Showing
1 changed file
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from pathlib import Path | ||
|
||
import pytest | ||
|
||
from depinspect import database | ||
from depinspect.archives.extract import process_archives | ||
from depinspect.archives.fetch import fetch_and_save_metadata | ||
from depinspect.distributions.loader import deserialize_metadata | ||
|
||
|
||
@pytest.fixture | ||
def data() -> dict[str, dict[str, dict[str, dict[str, str]]]]: | ||
return { | ||
"ubuntu": { | ||
"jammy": { | ||
"main": { | ||
"i386": "http://archive.ubuntu.com" | ||
"/ubuntu/dists/jammy/main" | ||
"/binary-i386/Packages.xz" | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
def test_initialize_from_archives( | ||
tmp_path: Path, data: dict[str, dict[str, dict[str, dict[str, str]]]] | ||
) -> None: | ||
fetch_and_save_metadata(data, tmp_path) | ||
process_archives(tmp_path) | ||
db_path = database.new("ubuntu_test.db", tmp_path) | ||
deserialize_metadata(tmp_path, db_path, "ubuntu") | ||
|
||
assert db_path.is_file(), "Database file is not created" | ||
assert db_path.suffix == ".db", "Unexpected database file extension" |