コード例 #1
0
 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)
コード例 #2
0
 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)
コード例 #3
0
 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)
コード例 #4
0
    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"]))
コード例 #5
0
    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"]))
コード例 #6
0
 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"]))
コード例 #7
0
 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"]))