summaryrefslogtreecommitdiffstats
path: root/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testbase.py
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testbase.py')
-rw-r--r--testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testbase.py42
1 files changed, 19 insertions, 23 deletions
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testbase.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testbase.py
index 318f5ceaa..870983f60 100644
--- a/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testbase.py
+++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testbase.py
@@ -29,16 +29,11 @@ class TestDebuggable(Bcfg2TestCase):
def test_set_debug(self):
d = self.get_obj()
- d.debug_log = Mock()
self.assertEqual(True, d.set_debug(True))
self.assertEqual(d.debug_flag, True)
- self.assertTrue(d.debug_log.called)
-
- d.debug_log.reset_mock()
self.assertEqual(False, d.set_debug(False))
self.assertEqual(d.debug_flag, False)
- self.assertTrue(d.debug_log.called)
def test_toggle_debug(self):
d = self.get_obj()
@@ -80,24 +75,25 @@ class TestPlugin(TestDebuggable):
@patch("os.makedirs")
@patch("os.path.exists")
def test__init(self, mock_exists, mock_makedirs):
- core = Mock()
- core.setup = MagicMock()
-
- mock_exists.return_value = True
- p = self.get_obj(core=core)
- self.assertEqual(p.data, os.path.join(datastore, p.name))
- self.assertEqual(p.core, core)
- mock_exists.assert_any_call(p.data)
- self.assertFalse(mock_makedirs.called)
-
- mock_exists.reset_mock()
- mock_makedirs.reset_mock()
- mock_exists.return_value = False
- p = self.get_obj(core=core)
- self.assertEqual(p.data, os.path.join(datastore, p.name))
- self.assertEqual(p.core, core)
- mock_exists.assert_any_call(p.data)
- mock_makedirs.assert_any_call(p.data)
+ if self.test_obj.create:
+ core = Mock()
+ core.setup = MagicMock()
+
+ mock_exists.return_value = True
+ p = self.get_obj(core=core)
+ self.assertEqual(p.data, os.path.join(datastore, p.name))
+ self.assertEqual(p.core, core)
+ mock_exists.assert_any_call(p.data)
+ self.assertFalse(mock_makedirs.called)
+
+ mock_exists.reset_mock()
+ mock_makedirs.reset_mock()
+ mock_exists.return_value = False
+ p = self.get_obj(core=core)
+ self.assertEqual(p.data, os.path.join(datastore, p.name))
+ self.assertEqual(p.core, core)
+ mock_exists.assert_any_call(p.data)
+ mock_makedirs.assert_any_call(p.data)
@patch("os.makedirs")
def test_init_repo(self, mock_makedirs):