2014-10-03 20:53:28 +02:00
|
|
|
# TODO: header
|
|
|
|
|
|
|
|
from ansible.playbook.task import Task
|
|
|
|
import unittest
|
|
|
|
|
|
|
|
basic_shell_task = dict(
|
|
|
|
name = 'Test Task',
|
|
|
|
shell = 'echo hi'
|
|
|
|
)
|
|
|
|
|
2014-10-06 23:06:13 +02:00
|
|
|
kv_shell_task = dict(
|
|
|
|
action = 'shell echo hi'
|
|
|
|
)
|
|
|
|
|
2014-10-03 20:53:28 +02:00
|
|
|
class TestTask(unittest.TestCase):
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def tearDown(self):
|
|
|
|
pass
|
|
|
|
|
2014-10-06 21:27:41 +02:00
|
|
|
def test_construct_empty_task(self):
|
2014-10-03 20:53:28 +02:00
|
|
|
t = Task()
|
|
|
|
|
2014-10-06 21:27:41 +02:00
|
|
|
def test_construct_task_with_role(self):
|
2014-10-03 20:53:28 +02:00
|
|
|
pass
|
|
|
|
|
2014-10-06 21:27:41 +02:00
|
|
|
def test_construct_task_with_block(self):
|
2014-10-03 20:53:28 +02:00
|
|
|
pass
|
|
|
|
|
2014-10-06 21:27:41 +02:00
|
|
|
def test_construct_task_with_role_and_block(self):
|
2014-10-03 20:53:28 +02:00
|
|
|
pass
|
|
|
|
|
2014-10-06 21:27:41 +02:00
|
|
|
def test_load_simple_task(self):
|
|
|
|
t = Task.load(basic_shell_task)
|
|
|
|
assert t is not None
|
|
|
|
assert t.name == basic_shell_task['name']
|
2014-10-06 22:29:02 +02:00
|
|
|
assert t.action == 'shell'
|
2014-10-06 21:27:41 +02:00
|
|
|
assert t.args == 'echo hi'
|
2014-10-03 20:53:28 +02:00
|
|
|
|
2014-10-06 21:27:41 +02:00
|
|
|
def test_can_load_action_kv_form(self):
|
2014-10-06 23:06:13 +02:00
|
|
|
t = Task.load(kv_shell_task)
|
|
|
|
assert t.action == 'shell'
|
|
|
|
assert t.args == 'echo hi'
|
|
|
|
|
|
|
|
def test_can_auto_name(self):
|
|
|
|
assert 'name' not in kv_shell_task
|
|
|
|
t = Task.load(kv_shell_task)
|
|
|
|
print "GOT NAME=(%s)" % t.name
|
|
|
|
assert t.name == 'shell echo hi'
|
|
|
|
|
|
|
|
def test_can_auto_name_with_role(self):
|
2014-10-06 21:27:41 +02:00
|
|
|
pass
|
|
|
|
|
|
|
|
def test_can_load_action_complex_form(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def test_can_load_module_complex_form(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def test_local_action_implies_delegate(self):
|
|
|
|
pass
|
2014-10-03 20:53:28 +02:00
|
|
|
|
2014-10-06 21:27:41 +02:00
|
|
|
def test_local_action_conflicts_with_delegate(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def test_delegate_to_parses(self):
|
|
|
|
pass
|