test(audiobook_library): add test functions
This commit is contained in:
1 parent
8f027e2226
commit
0ab31d16c2
6 files changed
+486
No files matched your search
@@ -0,0 +1,29 @@
|
||||
"""Generate non-sensitive database fixtures for CI."""
|
||||
|
||||
import json
|
||||
import sqlite3
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def create_fixtures(assets: Path) -> None:
|
||||
assets.mkdir(parents=True, exist_ok=True)
|
||||
with sqlite3.connect(assets / "absdatabase.sqlite_test") as db:
|
||||
db.execute(
|
||||
"CREATE TABLE books (id INTEGER PRIMARY KEY, title TEXT, genres TEXT, audioFiles TEXT)"
|
||||
)
|
||||
db.execute("CREATE TABLE libraries (id INTEGER PRIMARY KEY, name TEXT)")
|
||||
db.execute("INSERT INTO libraries VALUES (1, 'Test Library')")
|
||||
db.execute(
|
||||
"INSERT INTO books VALUES (?, ?, ?, ?)",
|
||||
(
|
||||
1,
|
||||
"Test Book",
|
||||
json.dumps(["Sci-Fi"]),
|
||||
json.dumps([{"metaTags": {"tagComment": "short"}}]),
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
create_fixtures(Path(sys.argv[1]))
|
||||
Reference in new issue
Block a user