@pytest.mark.skipif(IS_WINDOWS, reason='datetime logic does not work when OS not on GMT')
def test_secretary_tool_updates_only_matured_reports(test_perf_alert, test_perf_alert_2, create_record):
    create_record(test_perf_alert)
    date_past = (datetime.utcnow() - timedelta(hours=5))
    with patch('django.utils.timezone.now', Mock(return_value=date_past)):
        create_record(test_perf_alert_2)
    assert (BackfillRecord.objects.count() == 2)
    assert (BackfillRecord.objects.filter(status=BackfillRecord.PRELIMINARY).count() == 2)
    SecretaryTool.mark_reports_for_backfill()
    assert (BackfillRecord.objects.filter(status=BackfillRecord.PRELIMINARY).count() == 1)
@pytest.mark.skipif(IS_WINDOWS, reason='datetime logic does not work when OS not on GMT')
def test_secretary_tool_updates_only_matured_reports(test_perf_alert, test_perf_alert_2, create_record):
    create_record(test_perf_alert)
    date_past = (datetime.utcnow() - timedelta(hours=5))
    with patch('django.utils.timezone.now', Mock(return_value=date_past)):
        create_record(test_perf_alert_2)
    assert (BackfillRecord.objects.count() == 2)
    assert (BackfillRecord.objects.filter(status=BackfillRecord.PRELIMINARY).count() == 2)
    SecretaryTool.mark_reports_for_backfill()
    assert (BackfillRecord.objects.filter(status=BackfillRecord.PRELIMINARY).count() == 1)