Initial commit
This commit is contained in:
57
backend/tests/data_fixtures.py
Normal file
57
backend/tests/data_fixtures.py
Normal file
@@ -0,0 +1,57 @@
|
||||
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",
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user