Fixing up v2 unit tests

This commit is contained in:
James Cammarata 2015-05-12 12:24:57 -05:00
parent 361eb29146
commit 1ca8cb8553
4 changed files with 21 additions and 10 deletions

View file

@ -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)