summaryrefslogtreecommitdiffstats
path: root/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgEncryptedCheetahGenerator.py
diff options
context:
space:
mode:
authorChris St. Pierre <chris.a.st.pierre@gmail.com>2012-10-02 15:00:03 -0400
committerChris St. Pierre <chris.a.st.pierre@gmail.com>2012-10-02 15:00:03 -0400
commitadf037aa31031be164e68b1a4817a7cada936c90 (patch)
treee4913b33fbed2bb480a2090b419a7fb3fddc67a7 /testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgEncryptedCheetahGenerator.py
parent414f1c017f5a1e0f0549bcb27175983b04e3312c (diff)
downloadbcfg2-adf037aa31031be164e68b1a4817a7cada936c90.tar.gz
bcfg2-adf037aa31031be164e68b1a4817a7cada936c90.tar.bz2
bcfg2-adf037aa31031be164e68b1a4817a7cada936c90.zip
testsuite: added unit tests for Cfg handlers
Diffstat (limited to 'testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgEncryptedCheetahGenerator.py')
-rw-r--r--testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgEncryptedCheetahGenerator.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgEncryptedCheetahGenerator.py b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgEncryptedCheetahGenerator.py
new file mode 100644
index 000000000..0522b9206
--- /dev/null
+++ b/testsuite/Testsrc/Testlib/TestServer/TestPlugins/TestCfg/TestCfgEncryptedCheetahGenerator.py
@@ -0,0 +1,50 @@
+import os
+import sys
+from mock import Mock, MagicMock, patch
+from Bcfg2.Server.Plugins.Cfg.CfgEncryptedCheetahGenerator import *
+
+# add all parent testsuite directories to sys.path to allow (most)
+# relative imports in python 2.4
+path = os.path.dirname(__file__)
+while path != "/":
+ if os.path.basename(path).lower().startswith("test"):
+ sys.path.append(path)
+ if os.path.basename(path) == "testsuite":
+ break
+ path = os.path.dirname(path)
+from common import XI_NAMESPACE, XI, inPy3k, call, builtins, u, can_skip, \
+ skip, skipIf, skipUnless, Bcfg2TestCase, DBModelTestCase, syncdb, \
+ patchIf, datastore, re_type
+
+try:
+ from TestServer.TestPlugins.TestCfg.TestCfgCheetahGenerator import \
+ TestCfgCheetahGenerator
+ HAS_CHEETAH = True
+except ImportError:
+ TestCfgCheetahGenerator = object
+ HAS_CHEETAH = False
+
+try:
+ from TestServer.TestPlugins.TestCfg.TestCfgEncryptedGenerator import \
+ TestCfgEncryptedGenerator
+ HAS_CRYPTO = True
+except ImportError:
+ TestCfgEncryptedGenerator = object
+ HAS_CRYPTO = False
+
+
+if can_skip or (HAS_CRYPTO and HAS_CHEETAH):
+ class TestCfgEncryptedCheetahGenerator(TestCfgCheetahGenerator,
+ TestCfgEncryptedGenerator):
+ test_obj = CfgEncryptedCheetahGenerator
+
+ @skipUnless(HAS_CRYPTO, "Encryption libraries not found, skipping")
+ @skipUnless(HAS_CHEETAH, "Cheetah libraries not found, skipping")
+ def setUp(self):
+ pass
+
+ def test_handle_event(self):
+ TestCfgEncryptedGenerator.test_handle_event(self)
+
+ def test_get_data(self):
+ TestCfgCheetahGenerator.test_get_data(self)