summaryrefslogtreecommitdiffstats
path: root/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestGroupPatterns.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2013-03-25 13:31:21 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2013-03-25 13:31:21 -0400
commit9c603d8267c0a511968a8a553d7fa0b2d5bf9b73 (patch)
treec473a7615586dc22d585bda67e118ed2fe535754 /testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestGroupPatterns.py
parent3dc289678812238c2fcc54098b1d8de9bf64f900 (diff)
downloadbcfg2-9c603d8267c0a511968a8a553d7fa0b2d5bf9b73.tar.gz
bcfg2-9c603d8267c0a511968a8a553d7fa0b2d5bf9b73.tar.bz2
bcfg2-9c603d8267c0a511968a8a553d7fa0b2d5bf9b73.zip
Handle FAM monitor failures more gracefully:
* Where possible, create the file or directory that is about to be monitored. This ensures that content can be added later without need to restart Bcfg2. (Otherwise, adding the monitor would fail, and so when you did create the file in question, bcfg2-server would never be notified of it.) * When not possible, give better error messages.
Diffstat (limited to 'testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestGroupPatterns.py')
-rw-r--r--testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestGroupPatterns.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestGroupPatterns.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestGroupPatterns.py
index a9346156c..c6e6f5ef7 100644
--- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestGroupPatterns.py
+++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestGroupPatterns.py
@@ -92,7 +92,12 @@ class TestPatternFile(TestXMLFileBacked):
core.fam = fam
elif not core:
core = Mock()
- return self.test_obj(path, core=core)
+
+ @patchIf(not isinstance(lxml.etree.Element, Mock),
+ "lxml.etree.Element", Mock())
+ def inner():
+ return self.test_obj(path, core=core)
+ return inner()
@patch("Bcfg2.Server.Plugins.GroupPatterns.PatternMap")
def test_Index(self, mock_PatternMap):
@@ -135,6 +140,14 @@ class TestPatternFile(TestXMLFileBacked):
class TestGroupPatterns(TestPlugin, TestConnector):
test_obj = GroupPatterns
+ def get_obj(self, core=None):
+ @patchIf(not isinstance(lxml.etree.Element, Mock),
+ "lxml.etree.Element", Mock())
+ def inner():
+ return TestPlugin.get_obj(self, core=core)
+ return inner()
+
+
def test_get_additional_groups(self):
gp = self.get_obj()
gp.config = Mock()