from crawler.spiders.public_spider import PublicSpider


def test_allowlist_filtering(monkeypatch, tmp_path):
    allow = tmp_path / "allowlist.txt"
    allow.write_text("""
https://allowed.example/
""", encoding="utf-8")
    monkeypatch.setenv("ALLOWLIST_PATH", str(allow))
    spider = PublicSpider()
    assert spider._allowed("https://allowed.example/page") is True
    assert spider._allowed("https://blocked.example/page") is False


