# Feature: sentinel-lens-dashboard, Property 2: GeoResolver 字段完整性

from hypothesis import given, settings
from hypothesis import strategies as st

from backend.app.services.geo import GeoResolver


@given(ip=st.text())
@settings(max_examples=100)
def test_geo_resolver_fields_never_none(ip: str) -> None:
    """**Property 2: GeoResolver 字段完整性**
    **Validates: Requirements 1.4, 1.5**

    For any arbitrary string input as IP, the returned GeoInfo must have
    non-None country and city fields.
    """
    resolver = GeoResolver(db_path="./GeoLite2-City.mmdb")
    result = resolver.resolve(ip)
    assert result.country is not None
    assert result.city is not None
