diff options
Diffstat (limited to 'test/TestPlayBook.py')
-rw-r--r-- | test/TestPlayBook.py | 52 |
1 files changed, 51 insertions, 1 deletions
diff --git a/test/TestPlayBook.py b/test/TestPlayBook.py index c0a8895783..af233ff103 100644 --- a/test/TestPlayBook.py +++ b/test/TestPlayBook.py @@ -204,7 +204,28 @@ class TestPlaybook(unittest.TestCase): "localhost": { "changed": 0, "failures": 0, - "ok": 10, + "ok": 6, + "skipped": 0, + "unreachable": 0 + } + } + print "**EXPECTED**" + print utils.jsonify(expected, format=True) + + assert utils.jsonify(expected, format=True) == utils.jsonify(actual,format=True) + + def test_task_includes(self): + pb = os.path.join(self.test_dir, 'task-includer.yml') + actual = self._run(pb) + + # if different, this will output to screen + print "**ACTUAL**" + print utils.jsonify(actual, format=True) + expected = { + "localhost": { + "changed": 0, + "failures": 0, + "ok": 1, "skipped": 0, "unreachable": 0 } @@ -239,6 +260,35 @@ class TestPlaybook(unittest.TestCase): play = ansible.playbook.Play(playbook, playbook.playbook[0], os.getcwd()) assert play.hosts == ';'.join(('host1', 'host2', 'host3')) + def test_playbook_when(self): + test_callbacks = TestCallbacks() + playbook = ansible.playbook.PlayBook( + playbook=os.path.join(self.test_dir, 'playbook-when.yml'), + host_list='test/ansible_hosts', + extra_vars={ 'external' : 'xyz', 'identity': 'identity' }, + stats=ans_callbacks.AggregateStats(), + callbacks=test_callbacks, + runner_callbacks=test_callbacks + ) + actual = playbook.run() + + # if different, this will output to screen + print "**ACTUAL**" + print utils.jsonify(actual, format=True) + expected = { + "localhost": { + "changed": 0, + "failures": 0, + "ok": 3, + "skipped": 3, + "unreachable": 0 + } + } + print "**EXPECTED**" + print utils.jsonify(expected, format=True) + + assert utils.jsonify(expected, format=True) == utils.jsonify(actual,format=True) + def test_playbook_hash_replace(self): # save default hash behavior so we can restore it in the end of the test saved_hash_behavior = C.DEFAULT_HASH_BEHAVIOUR |