Files
chitai/backend/tests/data_fixtures.py
2025-12-04 00:33:37 -05:00

58 lines
1.7 KiB
Python

from pathlib import Path
import pytest
from typing import Any
from chitai.database import models as m
@pytest.fixture(name="raw_users")
def fx_raw_users() -> list[m.User | dict[str, Any]]:
"""Unstructured user representations."""
return [
{"email": "user1@example.com", "password": "password123"},
{"email": "user2@example.com", "password": "password234"},
]
@pytest.fixture(name="raw_libraries")
def fx_raw_libraries(tmp_path: Path) -> list[m.Library | dict[str, Any]]:
"""Unstructured library representations."""
return [
{
"name": "Default Test Library",
"slug": "default-test-library",
"root_path": f"{tmp_path}/default_library",
"path_template": "{author}/{title}",
"read_only": False,
},
{
"name": "Test Textbook Library",
"slug": "test-textbook-library",
"root_path": f"{tmp_path}/textbooks",
"path_template": "{author}/{title}",
"read_only": False,
},
]
@pytest.fixture(name="raw_books")
def fx_raw_books() -> list[m.Book | dict[str, Any]]:
"""Unstructured book representations."""
return [
{
"library_id": 1,
"title": "The Fellowship of the Ring",
"path": "books/J.R.R Tolkien/Lord of the Rings/01 - The Fellowship of The Ring",
"pages": 427,
"authors": [{"name": "J.R.R Tolkien"}],
"tags": [{"name": "Fantasy"}, {"name": "Adventure"}],
"identifiers": {"isbn-13": "9780261102354"},
"series": {"name": "The Lord of the Rings"},
"series_position": "1",
}
]