3
0
Fork 0

test: make DataTestCase inherit from ConfigTestCase

just some housekeeping
This commit is contained in:
Lance Edgar 2025-10-21 12:46:49 -05:00
parent f35d1a1cb6
commit e76ced917e

View file

@ -179,8 +179,7 @@ class ConfigTestCase(FileTestCase):
return WuttaConfig(**kwargs) return WuttaConfig(**kwargs)
# TODO: this should inherit from ConfigTestCase class DataTestCase(ConfigTestCase):
class DataTestCase(FileTestCase):
""" """
Base class for test suites requiring a full (typical) database. Base class for test suites requiring a full (typical) database.
@ -220,15 +219,8 @@ class DataTestCase(FileTestCase):
""" """
Perform config/app/db setup operations for the test. Perform config/app/db setup operations for the test.
""" """
self.setup_files() self.setup_config()
self.config = self.make_config(
defaults={
"wutta.db.default.url": "sqlite://",
}
)
self.app = self.config.get_app()
# init db
model = self.app.model model = self.app.model
model.Base.metadata.create_all(bind=self.config.appdb_engine) model.Base.metadata.create_all(bind=self.config.appdb_engine)
self.session = self.app.make_session() self.session = self.app.make_session()
@ -241,8 +233,10 @@ class DataTestCase(FileTestCase):
""" """
Perform config/app/db teardown operations for the test. Perform config/app/db teardown operations for the test.
""" """
self.teardown_files() self.teardown_config()
def make_config(self, **kwargs): # pylint: disable=empty-docstring def make_config(self, **kwargs): # pylint: disable=empty-docstring
""" """ """ """
return WuttaConfig(**kwargs) defaults = kwargs.setdefault("defaults", {})
defaults.setdefault("wutta.db.default.url", "sqlite://")
return super().make_config(**kwargs)