def test_v2_playbook_on_start_called(self): p = playbook.ZMQPlaybook( self.get_playbook_path("zmq_runner_on_ok.yml")) m = mock.Mock() p.add_hook('v2_playbook_on_start', m) p.run(Inventory(["localhost"])) self.assertTrue(m.called)
def test_v2_on_any_called(self): p = playbook.ZMQPlaybook( self.get_playbook_path("zmq_runner_on_ok.yml")) m = mock.Mock() p.add_hook('v2_on_any', m) p.run(Inventory(["localhost"])) self.assertEquals(m.call_count, 7)
def test_v2_playbook_on_task_start_called(self): p = playbook.ZMQPlaybook( self.get_playbook_path("zmq_playbook_on_task_start.yml")) m = mock.Mock() p.add_hook('v2_playbook_on_task_start', m) p.run(Inventory(["localhost"])) self.assertEquals(m.call_count, 3)
def test_v2_playbook_on_start_called(self): p = playbook.ZMQPlaybook( self.get_playbook_path("zmq_runner_on_ok.yml")) def test_playbook(playbook): self.assertIn('_entries', playbook) self.assertIn('_basedir', playbook) self.assertIn('_file_name', playbook) p.add_hook('v2_playbook_on_start', test_playbook) p.run(Inventory(["localhost"]))
def test_v2_playbook_on_stats(self): p = playbook.ZMQPlaybook( self.get_playbook_path("zmq_runner_on_ok.yml")) def test_stats(stats): self.assertIn('failures', stats) self.assertIn('skipped', stats) self.assertIn('ok', stats) self.assertIn('processed', stats) self.assertIn('changed', stats) p.add_hook('v2_playbook_on_stats', test_stats) p.run(Inventory(["localhost"]))
def test_v2_runner_on_skipped(self): p = playbook.ZMQPlaybook( self.get_playbook_path("zmq_runner_on_skipped.yml")) p.add_hook('v2_runner_on_skipped', self.check_task_result) p.run(Inventory(["localhost"]))
def test_v2_playbook_on_task_start(self): p = playbook.ZMQPlaybook( self.get_playbook_path("zmq_playbook_on_task_start.yml")) p.add_hook('v2_playbook_on_task_start', self.check_task) p.run(Inventory(["localhost"]))