def METHOD_NAME(admin_request, mocker, sample_template):
    # first time it is called redis returns data, second time returns none
    mock_dao = mocker.patch(
        "app.template_statistics.rest.fetch_notification_status_for_service_for_today_and_7_previous_days",
        return_value=[
            Mock(
                template_id=sample_template.id,
                count=3,
                template_name=sample_template.name,
                notification_type=sample_template.template_type,
                status="created",
                is_precompiled_letter=False,
            )
        ],
    )
    json_resp = admin_request.get(
        "template_statistics.get_template_statistics_for_service_by_day",
        service_id=sample_template.service_id,
        whole_days=1,
    )
    assert json_resp["data"] == [
        {
            "template_id": str(sample_template.id),
            "count": 3,
            "template_name": sample_template.name,
            "template_type": sample_template.template_type,
            "status": "created",
            "is_precompiled_letter": False,
        }
    ]
    # dao only called for 2nd, since redis returned values for first call
    mock_dao.assert_called_once_with(str(sample_template.service_id), limit_days=1, by_template=True)