From ae58c24f72a8ed72327fbc3f7305bd69ec6a13db Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Thu, 17 Jan 2013 09:20:37 -0500 Subject: Made a few encryption things simpler: * Only one strict/lax setting, in [encryption], rather than separate settings in [properties] and [sshkeys] * No longer necessary to enable encryption on each Properties file --- .../Testlib/TestServer/TestPlugins/TestProperties.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'testsuite/Testsrc/Testlib/TestServer') diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py index 1a8619097..d66780a20 100644 --- a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py +++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py @@ -247,14 +247,17 @@ class TestXMLPropertyFile(TestPropertyFile, TestStructFile): TestStructFile.test_Index(self) pf = self.get_obj() - pf.xdata = lxml.etree.Element("Properties", encryption="true") + pf.xdata = lxml.etree.Element("Properties") + lxml.etree.SubElement(pf.xdata, "Crypted", encrypted="foo") pf.data = lxml.etree.tostring(pf.xdata) # extra test: crypto is not available, but properties file is # encrypted has_crypto = Bcfg2.Server.Plugins.Properties.HAS_CRYPTO Bcfg2.Server.Plugins.Properties.HAS_CRYPTO = False - self.assertRaises(PluginExecutionError, pf.Index) - Bcfg2.Server.Plugins.Properties.HAS_CRYPTO = has_crypto + try: + self.assertRaises(PluginExecutionError, pf.Index) + finally: + Bcfg2.Server.Plugins.Properties.HAS_CRYPTO = has_crypto @skipUnless(HAS_CRYPTO, "No crypto libraries found, skipping") def test_Index_crypto(self): @@ -262,7 +265,7 @@ class TestXMLPropertyFile(TestPropertyFile, TestStructFile): pf._decrypt = Mock() pf._decrypt.return_value = 'plaintext' pf.data = ''' - + crypted plain @@ -274,6 +277,9 @@ class TestXMLPropertyFile(TestPropertyFile, TestStructFile): ''' + print "HAS_CRYPTO: %s" % HAS_CRYPTO + print "Properties HAS_CRYPTO: %s" % Bcfg2.Server.Plugins.Properties.HAS_CRYPTO + # test successful decryption pf.Index() self.assertItemsEqual(pf._decrypt.call_args_list, -- cgit v1.2.3-1-g7c22