diff options
author | Sol Jerome <sol.jerome@gmail.com> | 2016-09-12 10:44:11 -0500 |
---|---|---|
committer | Sol Jerome <sol.jerome@gmail.com> | 2016-09-12 10:44:11 -0500 |
commit | a24fd9e6966e70014ea776ac266350f902833b1e (patch) | |
tree | c3ef9b384ab948c6bbed8e0fa2f58d36fd3b7d5c /testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py | |
parent | bf2dfbbebcf17840319955697d3a5edf4eb85960 (diff) | |
parent | b90204c1ed3380671cd5f887e35fd2e74700eaee (diff) | |
download | bcfg2-a24fd9e6966e70014ea776ac266350f902833b1e.tar.gz bcfg2-a24fd9e6966e70014ea776ac266350f902833b1e.tar.bz2 bcfg2-a24fd9e6966e70014ea776ac266350f902833b1e.zip |
Merge branch 'fix/testsuite/db-tests' of https://github.com/AlexanderS/bcfg2
Diffstat (limited to 'testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py')
-rw-r--r-- | testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py index 5a82100d0..9f6a9f320 100644 --- a/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py +++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py @@ -51,6 +51,7 @@ class TestFunctions(Bcfg2TestCase): class TestDatabaseBacked(TestPlugin): test_obj = DatabaseBacked + synced = False def setUp(self): TestPlugin.setUp(self) @@ -76,6 +77,15 @@ class TestDatabaseBacked(TestPlugin): setattr(Bcfg2.Options.setup, attr, True) self.assertRaises(PluginInitError, self.get_obj, core) + def syncdb(self, modeltest): + """ Given an instance of a :class:`DBModelTestCase` object, sync + and clean the database """ + inst = modeltest(methodName='test_syncdb') + if not self.__class__.synced: + inst.test_syncdb() + self.__class__.synced = True + inst.test_cleandb() + class TestPluginDatabaseModel(Bcfg2TestCase): """ placeholder for future tests """ |