Skip to content

Commit 9dc475e

Browse files
committed
add test for ansible playbook bin path
1 parent 98b0580 commit 9dc475e

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/cotea_internal_error_case.py

+19
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,25 @@ def tearDown(self) -> None:
1010
# to clear previous execution context
1111
remove_modules_from_imported(module_name_like="cotea")
1212

13+
def test_incorrect_playbook_bin_path(self):
14+
from cotea.runner import runner
15+
from cotea.arguments_maker import argument_maker
16+
17+
pb_path = "cotea_run_files/ok.yaml"
18+
inv_path = "cotea_run_files/inv"
19+
ansible_pb_bin = "/path/to/.venv/bin/ansible-playbook"
20+
21+
arg_maker = argument_maker()
22+
arg_maker.add_arg("-i", inv_path)
23+
24+
try:
25+
runner(pb_path, arg_maker, show_progress_bar=True, ansible_pb_bin=ansible_pb_bin)
26+
except Exception as e:
27+
self.assertTrue(str(e) == f"Ansible playbook bin {ansible_pb_bin} not found",
28+
msg="Unexpected exception message")
29+
else:
30+
self.assertFalse(True, msg="Ansible is supposed to fail due to incorrect ansible playbook bin path")
31+
1332
def test_incorrect_playbook_path_case(self):
1433
from cotea.runner import runner
1534
from cotea.arguments_maker import argument_maker

0 commit comments

Comments
 (0)