Skip to content

Commit

Permalink
tests: add mock update test
Browse files Browse the repository at this point in the history
  • Loading branch information
artem-burashnikov committed Dec 6, 2023
1 parent 0296795 commit cfa991f
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions tests/test_update.py
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"

0 comments on commit cfa991f

Please sign in to comment.