[WIP] Testing and reformuling

This commit is contained in:
2026-02-08 18:55:16 +01:00
parent 1531a5dc77
commit b00c35f19b
22 changed files with 144 additions and 30 deletions

35
tests/test_config.py Normal file
View File

@@ -0,0 +1,35 @@
import os
import unittest
from sqlalchemy.orm import Session
from sqlalchemy.orm import sessionmaker
from app.api.config.actions import install
from app.api.config.cruds.library import create, read
from app.schema.config import Library
import logging
logger = logging.getLogger(__name__)
class TestConfig(unittest.TestCase):
def setUp(self):
os.environ["DEV_URIA_BIBLIOGAME_CONFIG_DB"] = "sqlite:///"
os.environ["DEV_URIA_BIBLIOGAME_DEBUG"] = "true"
self.engine = install()
self.library = Library(
name="Library Test",
notes="My duckling library test",
connection_string="sqlite:///"
)
self.Session = sessionmaker(bind=self.engine)
self.session = self.Session()
create(self.session, self.library)
return super().setUp()
def test_install(self):
library_string = str(read(self.session, 1))
self.assertEqual(library_string, str(self.library))
if __name__ == "__main__":
unittest.main()