def test_no_action_when_in_progress(get_outcome_checker_mock, record_backfilled): outcome_checker_mock = get_outcome_checker_mock(OutcomeStatus.IN_PROGRESS) secretary = SecretaryTool(outcome_checker_mock) assert BackfillRecord.objects.filter(status=BackfillRecord.BACKFILLED).count() == 1 secretary.check_outcome() assert BackfillRecord.objects.filter(status=BackfillRecord.BACKFILLED).count() == 1
def test_check_outcome_after_fail(get_outcome_checker_mock, record_backfilled): outcome_checker_mock = get_outcome_checker_mock(OutcomeStatus.FAILED) secretary = SecretaryTool(outcome_checker_mock) assert BackfillRecord.objects.filter(status=BackfillRecord.BACKFILLED).count() == 1 assert BackfillRecord.objects.filter(status=BackfillRecord.FAILED).count() == 0 secretary.check_outcome() assert BackfillRecord.objects.filter(status=BackfillRecord.BACKFILLED).count() == 0 assert BackfillRecord.objects.filter(status=BackfillRecord.FAILED).count() == 1