Пример #1
0
 def test_start_job_new_state(self, mock_give_download_permissions,
                              mock_make_client):
     job = LandoJob(self.job.id, self.user)
     with self.assertRaises(ValidationError) as raised_exception:
         job.start()
     self.assertEqual(raised_exception.exception.detail[0],
                      'Job needs authorization token before it can start.')
Пример #2
0
 def test_start_job_already_has_perms(self, mock_give_download_permissions,
                                      mock_has_download_permissions,
                                      mock_make_client):
     self.job.state = Job.JOB_STATE_AUTHORIZED
     self.job.save()
     mock_has_download_permissions.return_value = True
     job = LandoJob(self.job.id, self.user)
     job.start()
     mock_make_client().start_job.assert_called()
     self.assertFalse(mock_give_download_permissions.called)
Пример #3
0
 def test_start_job(self, mock_give_download_permissions,
                    mock_has_download_permissions, mock_make_client):
     self.job.state = Job.JOB_STATE_AUTHORIZED
     self.job.save()
     mock_has_download_permissions.return_value = False
     job = LandoJob(self.job.id, self.user)
     job.start()
     mock_make_client().start_job.assert_called()
     mock_give_download_permissions.assert_has_calls(
         [call(self.user, '1234', '5432'),
          call(self.user, '1235', '5432')],
         any_order=True)