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()