Skip to content

Commit

Permalink
tests:database - add tests for key-value pairs tables
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoCampinoti94 committed Nov 7, 2023
1 parent dd1396a commit 8f26d5d
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ def test_database_tables(database_path: Path):
]
assert db.files.name in tables
assert db.history.name in tables
assert db.metadata.name in tables

# Test views existence
views: list[str] = [
Expand Down Expand Up @@ -114,6 +115,25 @@ def test_database_columns(database_path: Path):
assert columns_from_model == columns_from_sql


def test_database_keys_tables(database_path: Path):
assert database_path.is_file()

db: FileDB = FileDB(database_path)

metadata = db.metadata.select()

assert isinstance(metadata, db.metadata.model)
assert metadata.version == __version__

metadata.version = __version__ + "-test"
db.metadata.update(metadata)
db.commit()

metadata2 = db.metadata.select()

assert metadata.model_dump() == metadata2.model_dump()


def test_insert_select(database_path: Path, test_file: File):
assert database_path.is_file()

Expand Down

0 comments on commit 8f26d5d

Please sign in to comment.