diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-11-25 13:33:32 -0500 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-11-25 13:33:32 -0500 |
commit | e614d5a90baa771d6cda3860352890fdeb86236d (patch) | |
tree | be4286cb2a267dd068645517c76d995db65b9433 /testsuite | |
parent | 1c7488e85200e50429b1248d36a6815bedc49f02 (diff) | |
download | bcfg2-e614d5a90baa771d6cda3860352890fdeb86236d.tar.gz bcfg2-e614d5a90baa771d6cda3860352890fdeb86236d.tar.bz2 bcfg2-e614d5a90baa771d6cda3860352890fdeb86236d.zip |
testsuite: make DatabaseBacked tests work without django installed
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py index eac4faf90..f0531d113 100644 --- a/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py +++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py @@ -77,6 +77,14 @@ class TestFunctions(Bcfg2TestCase): class TestDatabaseBacked(TestPlugin): test_obj = DatabaseBacked + def get_obj(self, core=None): + if not HAS_DJANGO: + if core is None: + core = Mock() + # disable the database + core.setup.cfp.getboolean.return_value = False + return TestPlugin.get_obj(self, core=core) + @skipUnless(HAS_DJANGO, "Django not found") def test__use_db(self): core = Mock() |