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'
|
|
|
|
)
|
|
|
|
|
|
|
|
class TestTask(unittest.TestCase):
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
pass
|
|
|
|
|
|
|
|
def tearDown(self):
|
|
|
|
pass
|
|
|
|
|
2014-10-03 22:37:32 +02:00
|
|
|
def test_can_construct_empty_task(self):
|
2014-10-03 20:53:28 +02:00
|
|
|
t = Task()
|
|
|
|
|
2014-10-03 22:37:32 +02:00
|
|
|
def test_can_construct_task_with_role(self):
|
2014-10-03 20:53:28 +02:00
|
|
|
pass
|
|
|
|
|
2014-10-03 22:37:32 +02:00
|
|
|
def test_can_construct_task_with_block(self):
|
2014-10-03 20:53:28 +02:00
|
|
|
pass
|
|
|
|
|
2014-10-03 22:37:32 +02:00
|
|
|
def test_can_construct_task_with_role_and_block(self):
|
2014-10-03 20:53:28 +02:00
|
|
|
pass
|
|
|
|
|
2014-10-03 22:37:32 +02:00
|
|
|
def test_can_load_simple_task(self):
|
2014-10-03 20:53:28 +02:00
|
|
|
t = Task.load(basic_shell_task)
|
2014-10-03 22:37:32 +02:00
|
|
|
assert t is not None
|
|
|
|
print "T.NAME = %s" % t.name
|
2014-10-03 20:53:28 +02:00
|
|
|
assert t.name == basic_shell_task['name']
|
|
|
|
assert t.module == 'shell'
|
|
|
|
assert t.args == 'echo hi'
|
|
|
|
|
|
|
|
|