From b7294206ffd1248997679eaaf5daa53a0a315054 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Tue, 6 Nov 2012 13:34:01 -0500 Subject: Properties: allow lax decryption, where failure to decrypt an element is not fatal and parsing of that file continues --- .../Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'testsuite/Testsrc/Testlib') 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 = ''' - + crypted 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): -- cgit v1.2.3-1-g7c22