test: make DataTestCase inherit from ConfigTestCase
just some housekeeping
This commit is contained in:
parent
f35d1a1cb6
commit
e76ced917e
1 changed files with 6 additions and 12 deletions
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue