diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-01-17 09:20:37 -0500 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2013-01-17 09:20:37 -0500 |
commit | ae58c24f72a8ed72327fbc3f7305bd69ec6a13db (patch) | |
tree | e8614b54239161156d76424251cfc868643488a0 /testsuite | |
parent | 873a373c7eda0ba523ea8b78c3c45d7e8f189628 (diff) | |
download | bcfg2-ae58c24f72a8ed72327fbc3f7305bd69ec6a13db.tar.gz bcfg2-ae58c24f72a8ed72327fbc3f7305bd69ec6a13db.tar.bz2 bcfg2-ae58c24f72a8ed72327fbc3f7305bd69ec6a13db.zip |
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
Diffstat (limited to 'testsuite')
-rw-r--r-- | testsuite/Testsrc/Testlib/TestEncryption.py | 5 | ||||
-rw-r--r-- | testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestProperties.py | 14 |
2 files changed, 10 insertions, 9 deletions
diff --git a/testsuite/Testsrc/Testlib/TestEncryption.py b/testsuite/Testsrc/Testlib/TestEncryption.py index 778d5b963..c03aa66e1 100644 --- a/testsuite/Testsrc/Testlib/TestEncryption.py +++ b/testsuite/Testsrc/Testlib/TestEncryption.py @@ -193,11 +193,6 @@ baz # test that different algorithms are used mock_passphrases.reset_mock() - self.assertRaises(EVPError, - bruteforce_decrypt, - crypted, setup=setup, algorithm=self.algo) - - mock_passphrases.reset_mock() crypted = ssl_encrypt(self.plaintext, passwd, algorithm=self.algo) self.assertEqual(self.plaintext, bruteforce_decrypt(crypted, setup=setup, 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 = ''' -<Properties encryption="true" decrypt="strict"> +<Properties decrypt="strict"> <Crypted encrypted="foo"> crypted <Plain foo="bar">plain</Plain> @@ -274,6 +277,9 @@ class TestXMLPropertyFile(TestPropertyFile, TestStructFile): </Plain> </Properties>''' + 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, |