def METHOD_NAME(app):
    """Tests that plays metrics can be queried with weekly buckets"""
    with app.app_context():
        db = get_db()
    # A Thursday
    date = datetime(2020, 10, 1).replace(minute=0, second=0, microsecond=0)
    test_entities = {
        "tracks": [
            {"track_id": 1, "title": "track 1"},
            {"track_id": 2, "title": "track 2"},
            {"track_id": 3, "title": "track 3"},
        ],
        "plays": [
            {"item_id": 1, "created_at": date + timedelta(hours=-1)},
            {"item_id": 1, "created_at": date + timedelta(hours=-1)},
            {"item_id": 1, "created_at": date + timedelta(days=-2)},
            {"item_id": 2, "created_at": date + timedelta(hours=-1)},
            {"item_id": 2, "created_at": date + timedelta(days=-2)},
            {"item_id": 3, "created_at": date + timedelta(days=-2)},
            {"item_id": 3, "created_at": date + timedelta(days=-2)},
            {"item_id": 3, "created_at": date + timedelta(days=-2)},
        ],
    }
    populate_mock_db(db, test_entities)
    start_time = date + timedelta(days=-3)
    args = GetPlayMetricsArgs(
        limit=10,
        start_time=date + timedelta(days=-3),
        bucket_size="week",
    )
    with db.scoped_session() as session:
        _index_hourly_play_counts(session)
        metrics = _get_plays_metrics(session, args)
    assert len(metrics) == 1
    assert metrics[0]["count"] == 8
    assert metrics[0]["timestamp"] == format_date(start_time)