Beispiel #1
0
    def test_can_update_a_job_if_it_has_invalid_documents(self):
        self.mock_job.state = None
        update_job(self.mock_job.pk, invalid_documents=True)
        self.assertEqual(self.mock_job.state, Job.FAILURE_STATE)

        # Checks if model instance was saved afterwards
        self.assertTrue(self.mock_job.save.called)
Beispiel #2
0
    def test_can_update_a_job_if_audit_sucessfull(self):
        self.mock_job.state = None
        fake_report_path = '/fake/path/'

        update_job(
            self.mock_job.pk,
            success=True,
            report_path=fake_report_path
        )

        self.assertEqual(self.mock_job.state, Job.SUCCESS_STATE)
        self.assertEqual(self.mock_job.report_file.name, fake_report_path)

        # Checks if model instance was saved afterwards
        self.assertTrue(self.mock_job.save.called)
Beispiel #3
0
 def test_can_get_a_job(self):
     update_job(self.mock_job.pk, success=True)
     self.mock_job_cls.objects.get.assert_called_once_with(
         pk=self.mock_job.pk
     )