"""CivicPlus staff directory h-card contact extraction."""
from scrapers.discovery.contact_extract_from_html import (
extract_civicplus_staff_directory_hcard_contacts_from_html,
)
def test_northport_city_council_hcards():
html = """
Mayor
Turnley Smith
Council Member - District 1
"""
rows = extract_civicplus_staff_directory_hcard_contacts_from_html(
html, "https://www.northportal.gov/220/City-Council"
)
assert len(rows) == 2
mayor = next(r for r in rows if r.get("email") == "dphillips@northportal.gov")
assert mayor["person_name"] == "Dale Phillips"
assert mayor["title_or_role"] == "Mayor"
assert mayor["phone"] == "(205) 394-1476"
assert "directory.aspx?eid=37" in (mayor.get("profile_url") or "")
d1 = next(r for r in rows if r.get("email") == "tsmith@northportal.gov")
assert d1["department"] == "District 1"
assert "Council Member" in (d1.get("title_or_role") or "")