"""Source registry tests.""" from coastwise.source_registry import ( load_official_sources, statewide_source_coverage, validate_source_registry, ) def test_source_registry_uses_official_https_urls_only(): sources = load_official_sources() issues = validate_source_registry(sources) assert sources assert not [issue for issue in issues if issue.severity == "error"] for source in sources: assert source.url.startswith("https://") assert "wildlife.ca.gov" in source.url or "cdph.ca.gov" in source.url def test_statewide_registry_includes_required_regions_and_cdph_sources(): sources = load_official_sources() source_ids = {source.id for source in sources} coverage = statewide_source_coverage() assert { "northern", "mendocino", "san_francisco", "central", "southern", "san_francisco_bay", } <= set(coverage.required_region_keys) assert set(coverage.required_source_ids) <= source_ids assert "cdfw_inseason_changes" in coverage.general_source_ids assert {"cdph_shellfish_advisories", "cdph_annual_mussel_quarantine"} <= set( coverage.cdph_source_ids )