diff options
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 """ |