|
|
|
@ -23,6 +23,7 @@ from ansible.compat.tests import unittest
|
|
|
|
|
from ansible.compat.tests.mock import patch, MagicMock
|
|
|
|
|
|
|
|
|
|
from ansible.errors import AnsibleError, AnsibleParserError
|
|
|
|
|
from ansible.executor.connection_info import ConnectionInformation
|
|
|
|
|
from ansible.executor.play_iterator import PlayIterator
|
|
|
|
|
from ansible.playbook import Playbook
|
|
|
|
|
|
|
|
|
@ -67,19 +68,28 @@ class TestPlayIterator(unittest.TestCase):
|
|
|
|
|
inventory.get_hosts.return_value = hosts
|
|
|
|
|
inventory.filter_hosts.return_value = hosts
|
|
|
|
|
|
|
|
|
|
itr = PlayIterator(inventory, p._entries[0])
|
|
|
|
|
task = itr.get_next_task_for_host(hosts[0])
|
|
|
|
|
connection_info = ConnectionInformation(play=p._entries[0])
|
|
|
|
|
|
|
|
|
|
itr = PlayIterator(
|
|
|
|
|
inventory=inventory,
|
|
|
|
|
play=p._entries[0],
|
|
|
|
|
connection_info=connection_info,
|
|
|
|
|
all_vars=dict(),
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
(host_state, task) = itr.get_next_task_for_host(hosts[0])
|
|
|
|
|
print(task)
|
|
|
|
|
self.assertIsNotNone(task)
|
|
|
|
|
task = itr.get_next_task_for_host(hosts[0])
|
|
|
|
|
(host_state, task) = itr.get_next_task_for_host(hosts[0])
|
|
|
|
|
print(task)
|
|
|
|
|
self.assertIsNotNone(task)
|
|
|
|
|
task = itr.get_next_task_for_host(hosts[0])
|
|
|
|
|
(host_state, task) = itr.get_next_task_for_host(hosts[0])
|
|
|
|
|
print(task)
|
|
|
|
|
self.assertIsNotNone(task)
|
|
|
|
|
task = itr.get_next_task_for_host(hosts[0])
|
|
|
|
|
(host_state, task) = itr.get_next_task_for_host(hosts[0])
|
|
|
|
|
print(task)
|
|
|
|
|
self.assertIsNotNone(task)
|
|
|
|
|
task = itr.get_next_task_for_host(hosts[0])
|
|
|
|
|
(host_state, task) = itr.get_next_task_for_host(hosts[0])
|
|
|
|
|
print(task)
|
|
|
|
|
self.assertIsNone(task)
|
|
|
|
|
|
|
|
|
|