def test__check_galaxy_history_state_percent_complete_is_100( self, galaxy_progress_mock): self.analysis_status.galaxy_history_progress = 100 _check_galaxy_history_state(self.analysis.uuid) analysis_status = AnalysisStatus.objects.get(analysis=self.analysis) self.assertEqual(analysis_status.galaxy_history_state, AnalysisStatus.OK) self.assertTrue(galaxy_progress_mock.called)
def test__check_galaxy_history_state_with_connection_error( self, retry_mock, galaxy_progress_mock): _check_galaxy_history_state(self.analysis.uuid) # Fetch analysis status since it has changed during # the course of this test and the old `self` reference is stale analysis_status = AnalysisStatus.objects.get(analysis=self.analysis) self.assertEqual(analysis_status.galaxy_history_state, AnalysisStatus.UNKNOWN) self.assertTrue(galaxy_progress_mock.called) self.assertTrue(retry_mock.called)
def test__check_galaxy_history_state_progress_less_than_percent_complete( self, retry_mock, galaxy_progress_mock): self.analysis_status.galaxy_history_progress = 25 _check_galaxy_history_state(self.analysis.uuid) analysis_status = AnalysisStatus.objects.get(analysis=self.analysis) self.assertEqual(analysis_status.galaxy_history_progress, 50) self.assertEqual(analysis_status.galaxy_history_state, AnalysisStatus.PROGRESS) self.assertTrue(galaxy_progress_mock.called) self.assertTrue(retry_mock.called)
def test__check_galaxy_history_state_percent_complete_is_100( self, galaxy_progress_mock ): self.analysis_status.galaxy_history_progress = 100 _check_galaxy_history_state(self.analysis.uuid) analysis_status = AnalysisStatus.objects.get(analysis=self.analysis) self.assertEqual(analysis_status.galaxy_history_state, AnalysisStatus.OK) self.assertTrue(galaxy_progress_mock.called)
def test__check_galaxy_history_state_progress_less_than_percent_complete( self, retry_mock, galaxy_progress_mock ): self.analysis_status.galaxy_history_progress = 25 _check_galaxy_history_state(self.analysis.uuid) analysis_status = AnalysisStatus.objects.get(analysis=self.analysis) self.assertEqual(analysis_status.galaxy_history_progress, 50) self.assertEqual(analysis_status.galaxy_history_state, AnalysisStatus.PROGRESS) self.assertTrue(galaxy_progress_mock.called) self.assertTrue(retry_mock.called)
def test__check_galaxy_history_state_with_connection_error( self, retry_mock, galaxy_progress_mock ): _check_galaxy_history_state(self.analysis.uuid) # Fetch analysis status since it has changed during # the course of this test and the old `self` reference is stale analysis_status = AnalysisStatus.objects.get(analysis=self.analysis) self.assertEqual(analysis_status.galaxy_history_state, AnalysisStatus.UNKNOWN) self.assertTrue(galaxy_progress_mock.called) self.assertTrue(retry_mock.called)
def test__check_galaxy_history_state_with_runtime_error( self, galaxy_cleanup_mock, send_email_mock, get_taskset_result_mock, galaxy_progress_mock): _check_galaxy_history_state(self.analysis.uuid) # Fetch analysis & analysis status since they have changed during # the course of this test and the old `self` references are stale analysis = Analysis.objects.get(uuid=self.analysis.uuid) analysis_status = AnalysisStatus.objects.get(analysis=analysis) self.assertEqual(analysis_status.galaxy_history_state, AnalysisStatus.ERROR) self.assertEqual(analysis.status, Analysis.FAILURE_STATUS) self.assertTrue(galaxy_progress_mock.called) self.assertTrue(get_taskset_result_mock.called) self.assertTrue(send_email_mock.called) self.assertTrue(galaxy_cleanup_mock.called)
def test__check_galaxy_history_state_with_runtime_error( self, galaxy_cleanup_mock, send_email_mock, get_taskset_result_mock, galaxy_progress_mock ): _check_galaxy_history_state(self.analysis.uuid) # Fetch analysis & analysis status since they have changed during # the course of this test and the old `self` references are stale analysis = Analysis.objects.get(uuid=self.analysis.uuid) analysis_status = AnalysisStatus.objects.get(analysis=analysis) self.assertEqual( analysis_status.galaxy_history_state, AnalysisStatus.ERROR ) self.assertEqual(analysis.status, Analysis.FAILURE_STATUS) self.assertTrue(galaxy_progress_mock.called) self.assertTrue(get_taskset_result_mock.called) self.assertTrue(send_email_mock.called) self.assertTrue(galaxy_cleanup_mock.called)