From e614d5a90baa771d6cda3860352890fdeb86236d Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Mon, 25 Nov 2013 13:33:32 -0500 Subject: testsuite: make DatabaseBacked tests work without django installed --- testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'testsuite/Testsrc/Testlib') 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() -- cgit v1.2.3-1-g7c22