mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Adding v2 task/block iterator and some reorganizing
This commit is contained in:
@@ -75,3 +75,9 @@ class TestBlock(unittest.TestCase):
|
||||
self.assertEqual(len(b.block), 1)
|
||||
assert isinstance(b.block[0], Task)
|
||||
|
||||
def test_block_compile(self):
|
||||
ds = [dict(action='foo')]
|
||||
b = Block.load(ds)
|
||||
tasks = b.compile()
|
||||
self.assertEqual(len(tasks), 1)
|
||||
self.assertIsInstance(tasks[0], Task)
|
||||
|
||||
@@ -117,4 +117,16 @@ class TestPlay(unittest.TestCase):
|
||||
roles=['foo'],
|
||||
), loader=fake_loader)
|
||||
|
||||
tasks = p.compile()
|
||||
|
||||
def test_play_compile(self):
|
||||
p = Play.load(dict(
|
||||
name="test play",
|
||||
hosts=['foo'],
|
||||
gather_facts=False,
|
||||
tasks=[dict(action='shell echo "hello world"')],
|
||||
))
|
||||
|
||||
tasks = p.compile()
|
||||
self.assertEqual(len(tasks), 1)
|
||||
self.assertIsInstance(tasks[0], Task)
|
||||
|
||||
@@ -45,6 +45,7 @@ class TestPlaybook(unittest.TestCase):
|
||||
""",
|
||||
})
|
||||
p = Playbook.load("test_file.yml", loader=fake_loader)
|
||||
entries = p.get_entries()
|
||||
|
||||
def test_bad_playbook_files(self):
|
||||
fake_loader = DictDataLoader({
|
||||
|
||||
@@ -45,6 +45,7 @@ class TestTaskInclude(unittest.TestCase):
|
||||
|
||||
def test_basic_task_include(self):
|
||||
ti = TaskInclude.load(AnsibleMapping(include='foo.yml'), loader=self._fake_loader)
|
||||
tasks = ti.compile()
|
||||
|
||||
def test_task_include_with_loop(self):
|
||||
ti = TaskInclude.load(AnsibleMapping(include='foo.yml', with_items=['a', 'b', 'c']), loader=self._fake_loader)
|
||||
|
||||
Reference in New Issue
Block a user