summaryrefslogtreecommitdiffstats
path: root/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-11-06 13:34:01 -0500
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-11-06 13:34:01 -0500
commitb7294206ffd1248997679eaaf5daa53a0a315054 (patch)
tree771bd356d0f234ce1885def0f4c4500c4097068e /testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py
parent5bc666e0f90b6bf1294003043f734de2d74d1a20 (diff)
downloadbcfg2-b7294206ffd1248997679eaaf5daa53a0a315054.tar.gz
bcfg2-b7294206ffd1248997679eaaf5daa53a0a315054.tar.bz2
bcfg2-b7294206ffd1248997679eaaf5daa53a0a315054.zip
Properties: allow lax decryption, where failure to decrypt an element is not fatal and parsing of that file continues
Diffstat (limited to 'testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py')
-rw-r--r--testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py
index 78cb5f52d..2fff67f8b 100644
--- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py
+++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py
@@ -256,7 +256,7 @@ class TestXMLPropertyFile(TestPropertyFile, TestStructFile):
pf._decrypt = Mock()
pf._decrypt.return_value = 'plaintext'
pf.data = '''
-<Properties encryption="true">
+<Properties encryption="true" decrypt="strict">
<Crypted encrypted="foo">
crypted
<Plain foo="bar">plain</Plain>
@@ -275,11 +275,18 @@ class TestXMLPropertyFile(TestPropertyFile, TestStructFile):
for el in pf.xdata.xpath("//Crypted"):
self.assertEqual(el.text, pf._decrypt.return_value)
- # test failed decryption
+ # test failed decryption, strict
pf._decrypt.reset_mock()
pf._decrypt.side_effect = EVPError
self.assertRaises(PluginExecutionError, pf.Index)
+ # test failed decryption, lax
+ pf.data = pf.data.replace("strict", "lax")
+ pf._decrypt.reset_mock()
+ pf.Index()
+ self.assertItemsEqual(pf._decrypt.call_args_list,
+ [call(el) for el in pf.xdata.xpath("//Crypted")])
+
@skipUnless(HAS_CRYPTO, "No crypto libraries found, skipping")
def test_decrypt(self):