def test_run_job(self, *args): server_service = ServerService(None, None, None) job = get_fake_job() server_service.run_job(job) self.assertEqual(get_call_count('set_job_start_state', args), 1) self.assertEqual(get_call_count('get_job_activity_instance', args), 1) self.assertEqual(get_call_count('add_job_activity_assigned', args), 1) self.assertEqual(get_call_count('run_job_instance', args), 1)
def test_run_job_exception(self, *args): server_service = ServerService(None, None, None) job = get_fake_job() server_service.run_job(job) self.assertEqual(get_call_count('set_job_start_state', args), 1) self.assertEqual(get_call_count('get_job_activity_instance', args), 1) self.assertEqual(get_call_count('add_job_activity_assigned', args), 1) self.assertEqual(get_call_count('run_job_instance', args), 1) actual_log = str(get_mock('log', args).call_args[0][0]) self.assertTrue(actual_log.endswith('run_job_instance exception'))