Skip to content

Commit

Permalink
tests:database - update test with the new File structure
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoCampinoti94 committed Oct 30, 2023
1 parent d688d0f commit bff2ec9
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions tests/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from acacore.database import model_to_columns
from acacore.database.base import ModelTable
from acacore.database.base import ModelView
from acacore.models.file import Action
from acacore.models.file import ConvertedFile
from acacore.models.file import File
from acacore.models.history import HistoryEntry
Expand All @@ -34,7 +33,7 @@ def test_file(test_files: Path, test_files_data: dict[str, dict]) -> File:
file_size_in_bytes=file.stat().st_size,
signature=filedata["matches"]["format"],
warning="; ".join(filedata["matches"]["warning"]),
action=Action.CONVERT,
action={"type": "CONVERT", "converter": "convertool", "outputs": ["odt", "pdf"]},
)


Expand Down Expand Up @@ -118,7 +117,6 @@ def test_insert_select(database_path: Path, test_file: File):

db: FileDB = FileDB(database_path)
test_file2 = test_file.model_copy(deep=True)
test_file2.id = test_file.id // 2
test_file2.uuid = uuid4()

db.files.insert(test_file)
Expand All @@ -132,13 +130,7 @@ def test_insert_select(database_path: Path, test_file: File):
assert cursor.table.name == db.files.name
assert test_file.model_dump() == result_file.model_dump()

cursor = db.files.select(order_by=[("ID", "asc")])
result_files = list(cursor)
assert len(result_files) == 2
assert result_files[0].uuid == test_file2.uuid
assert result_files[1].uuid == test_file.uuid

cursor = db.files.select(order_by=[("ID", "desc")])
cursor = db.files.select(order_by=[("ROWID", "asc")])
result_files = list(cursor)
assert len(result_files) == 2
assert result_files[0].uuid == test_file.uuid
Expand Down

0 comments on commit bff2ec9

Please sign in to comment.