def test_unlocking_hints_with_no_cost():
    """Test that hints with no cost can be unlocked"""
    app = create_ctfd()
    with app.app_context():
        register_user(app)
        chal = gen_challenge(app.db)
        chal_id = chal.id
        gen_hint(app.db, chal_id)
        client = login_as_user(app)
        # Attempt to access hint
        r = client.get("/api/v1/hints/1")
        resp = r.get_json()["data"]

        # Hint does not provide content until an unlock is generated
        assert resp.get("content") is None

        # We generate an unlock for the free hint
        client.post("/api/v1/unlocks", json={"target": 1, "type": "hints"})

        # We should now be able to see content
        r = client.get("/api/v1/hints/1")
        resp = r.get_json()["data"]
        assert resp.get("content") == "This is a hint"
    destroy_ctfd(app)
Test that hints with no cost can be unlocked
tests/users/test_hints.py