コード例 #1
0
ファイル: schedule_test.py プロジェクト: swdream/salt-1
 def test_run_job(self):
     '''
     Test if it run a scheduled job on the minion immediately.
     '''
     with patch.dict(schedule.__opts__, {'schedule': {}}):
         self.assertDictEqual(schedule.run_job('job1'), {
             'comment': 'Job job1 does not exist.',
             'result': False
         })
コード例 #2
0
ファイル: test_schedule.py プロジェクト: crimv42/saltstack
 def test_run_job(self):
     '''
     Test if it run a scheduled job on the minion immediately.
     '''
     with patch.dict(schedule.__opts__, {'schedule': {'job1': JOB1}, 'sock_dir': self.sock_dir}):
         mock = MagicMock(return_value=True)
         with patch.dict(schedule.__salt__, {'event.fire': mock}):
             _ret_value = {'complete': True, 'schedule': {'job1': JOB1}}
             with patch.object(SaltEvent, 'get_event', return_value=_ret_value):
                 self.assertDictEqual(schedule.run_job('job1'),
                                      {'comment': 'Scheduling Job job1 on minion.',
                                       'result': True})
コード例 #3
0
ファイル: schedule_test.py プロジェクト: HowardMei/saltstack
 def test_run_job(self):
     '''
     Test if it run a scheduled job on the minion immediately.
     '''
     with patch.dict(schedule.__opts__, {'schedule': {}, 'sock_dir': SOCK_DIR}):
         mock = MagicMock(return_value=True)
         with patch.dict(schedule.__salt__, {'event.fire': mock}):
             _ret_value = {'complete': True, 'schedule': {}}
             with patch.object(SaltEvent, 'get_event', return_value=_ret_value):
                 self.assertDictEqual(schedule.run_job('job1'),
                                      {'comment': 'Job job1 does not exist.',
                                       'result': False})
コード例 #4
0
 def test_run_job(self):
     """
     Test if it run a scheduled job on the minion immediately.
     """
     with patch.dict(
         schedule.__opts__, {"schedule": {"job1": JOB1}, "sock_dir": self.sock_dir}
     ):
         mock = MagicMock(return_value=True)
         with patch.dict(schedule.__salt__, {"event.fire": mock}):
             _ret_value = {"complete": True, "schedule": {"job1": JOB1}}
             with patch.object(SaltEvent, "get_event", return_value=_ret_value):
                 self.assertDictEqual(
                     schedule.run_job("job1"),
                     {"comment": "Scheduling Job job1 on minion.", "result": True},
                 )