import json
from spidercrypt import analyze_json_for_poisoning

def test_detect_poison(tmp_path):

    fake = [

        {
            "code":"eval(user_input)",
            "vulnerable":"safe"
        }

    ]

    file = tmp_path/"data.json"

    file.write_text(json.dumps(fake))

    report = analyze_json_for_poisoning(str(file))

    assert report["risk_score"] > 0
