Bladeren bron

[Tests] Add ansible_playbook param tests

monf 8 jaren geleden
bovenliggende
commit
5df21f9d4b

+ 0 - 0
neurons/ansible_playbook/tests/__init__.py


+ 27 - 0
neurons/ansible_playbook/tests/test_ansible_playbook.py

@@ -0,0 +1,27 @@
+import unittest
+
+from core.NeuronModule import MissingParameterException
+from neurons.ansible_playbook.ansible_playbook import Ansible_playbook
+
+
+class TestAnsible_Playbook(unittest.TestCase):
+
+    def setUp(self):
+        self.task_file="task_file"
+        self.random = "random"
+
+    def testParameters(self):
+        def run_test(parameters_to_test):
+            with self.assertRaises(MissingParameterException):
+                Ansible_playbook(**parameters_to_test)
+
+        # empty
+        parameters = dict()
+        run_test(parameters)
+
+        # missing task_file
+        parameters = {
+            "random": self.random
+        }
+        run_test(parameters)
+