def test_admins_can_preview_hints():
    """Test that admins are able to bypass restrictions and preview hints with ?preview=true"""
    app = create_ctfd()
    with app.app_context():
        gen_challenge(app.db)
        gen_hint(app.db, challenge_id=1, cost=100)
        client = login_as_user(app, name="admin", password="password")
        r = client.get("/api/v1/hints/1")
        assert r.status_code == 200
        hint = r.get_json()
        assert hint.get("content") is None

        r = client.get("/api/v1/hints/1?preview=true")
        assert r.status_code == 200
        hint = r.get_json()
        assert hint["data"]["content"] == "This is a hint"
    destroy_ctfd(app)
Test that admins are able to bypass restrictions and preview hints with ?preview=true
tests/api/v1/test_hints.py