summaryrefslogtreecommitdiffstats
path: root/testsuite/Testsrc/Testlib/TestServer
diff options
context:
space:
mode:
Diffstat (limited to 'testsuite/Testsrc/Testlib/TestServer')
-rw-r--r--testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py26
-rw-r--r--testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py5
2 files changed, 13 insertions, 18 deletions
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py
index 58e61e13b..94866cf39 100644
--- a/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py
+++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugin/Testhelpers.py
@@ -410,11 +410,12 @@ class TestXMLFileBacked(TestFileBacked):
should_monitor = None
path = os.path.join(datastore, "test", "test1.xml")
- @patch("os.makedirs", Mock())
def get_obj(self, path=None, fam=None, should_monitor=False):
if path is None:
path = self.path
- @patchIf(not isinstance(os.makedirs, Mock), "os.makedirs", Mock())
+
+ @patchIf(not isinstance(os.path.exists, Mock),
+ "os.path.exists", Mock())
def inner():
return self.test_obj(path, fam=fam, should_monitor=should_monitor)
return inner()
@@ -422,20 +423,16 @@ class TestXMLFileBacked(TestFileBacked):
def test__init(self):
fam = Mock()
xfb = self.get_obj()
- if self.should_monitor is True:
+ if self.should_monitor:
self.assertIsNotNone(xfb.fam)
+ fam.reset_mock()
+ xfb = self.get_obj(fam=fam, should_monitor=True)
+ fam.AddMonitor.assert_called_with(self.path, xfb)
else:
self.assertIsNone(xfb.fam)
-
- if self.should_monitor is not True:
xfb = self.get_obj(fam=fam)
self.assertFalse(fam.AddMonitor.called)
- if self.should_monitor is not False:
- fam.reset_mock()
- xfb = self.get_obj(fam=fam, should_monitor=True)
- fam.AddMonitor.assert_called_with(self.path, xfb)
-
@patch("glob.glob")
@patch("lxml.etree.parse")
def test_follow_xincludes(self, mock_parse, mock_glob):
@@ -623,7 +620,7 @@ class TestXMLFileBacked(TestFileBacked):
def test_add_monitor(self):
xfb = self.get_obj()
xfb.add_monitor("/test/test2.xml")
- self.assertIn("/test/test2.xml", xfb.extras)
+ self.assertIn("/test/test2.xml", xfb.extra_monitors)
fam = Mock()
if self.should_monitor is not True:
@@ -632,14 +629,14 @@ class TestXMLFileBacked(TestFileBacked):
fam.reset_mock()
xfb.add_monitor("/test/test3.xml")
self.assertFalse(fam.AddMonitor.called)
- self.assertIn("/test/test3.xml", xfb.extras)
+ self.assertIn("/test/test3.xml", xfb.extra_monitors)
if self.should_monitor is not False:
fam.reset_mock()
xfb = self.get_obj(fam=fam, should_monitor=True)
xfb.add_monitor("/test/test4.xml")
fam.AddMonitor.assert_called_with("/test/test4.xml", xfb)
- self.assertIn("/test/test4.xml", xfb.extras)
+ self.assertIn("/test/test4.xml", xfb.extra_monitors)
class TestStructFile(TestXMLFileBacked):
@@ -2036,6 +2033,3 @@ class TestGroupSpool(TestPlugin, TestGenerator):
gs.event_id.assert_called_with(event)
self.assertNotIn("/baz/quux", gs.entries)
self.assertNotIn("/baz/quux", gs.Entries[gs.entry_type])
-
-
-
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py
index 1022bdc5a..0794db62e 100644
--- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py
+++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProbes.py
@@ -3,6 +3,7 @@ import sys
import copy
import time
import lxml.etree
+import Bcfg2.version
import Bcfg2.Server
import Bcfg2.Server.Plugin
from mock import Mock, MagicMock, patch
@@ -217,6 +218,8 @@ group-specific"""
ps.get_matching.return_value = matching
metadata = Mock()
+ metadata.version_info = \
+ Bcfg2.version.Bcfg2VersionInfo(Bcfg2.version.__version__)
pdata = ps.get_probe_data(metadata)
ps.get_matching.assert_called_with(metadata)
# we can't create a matching operator.attrgetter object, and I
@@ -621,5 +624,3 @@ text
metadata.hostname = "nonexistent"
self.assertEqual(probes.get_additional_data(metadata),
ClientProbeDataSet())
-
-