示例#1
0
 def test_expand_action_defaults(self):
     job_doc = {
         'action_defaults': {
             'that_field': 'that_value'
         },
         'job_actions': [{
             'freezer_action': {
                 'not_that_field': 'some_value'
             }
         }, {
             'freezer_action': {
                 'that_field': 'another_value'
             }
         }]
     }
     expected_job_doc = {
         'job_actions': [{
             'freezer_action': {
                 'not_that_field': 'some_value',
                 'that_field': 'that_value'
             }
         }, {
             'freezer_action': {
                 'that_field': 'another_value'
             }
         }],
         'job_schedule': {}
     }
     job = v1_jobs.Job(job_doc)
     self.assertEqual(expected_job_doc, job.doc)
示例#2
0
 def _test_job_abort(self, status, event, response, need_update):
     job_schedule = {}
     if status is not None:
         job_schedule['status'] = status
     if event is not None:
         job_schedule['event'] = event
     job = v1_jobs.Job({'job_schedule': job_schedule})
     res = job.abort()
     self.assertEqual(response, res)
     self.assertEqual(need_update, job.need_update)
示例#3
0
 def test_execute_raises_BadDataFormat_when_event_not_implemented(self):
     job = v1_jobs.Job({})
     self.assertRaises(exceptions.BadDataFormat, job.execute_event, 'smile',
                       'my_params')
示例#4
0
 def test_execute_abort_event(self, mock_abort):
     job = v1_jobs.Job({})
     job.execute_event('abort', 'my_params')
     mock_abort.assert_called_once_with('my_params')
示例#5
0
 def test_execute_stop_event(self, mock_stop):
     job = v1_jobs.Job({})
     job.execute_event('stop', 'my_params')
     mock_stop.assert_called_once_with('my_params')