Refactor fail2ban DB path lookup and simplify geo router response
This commit is contained in:
@@ -12,7 +12,7 @@ from httpx import ASGITransport, AsyncClient
|
||||
from app.config import Settings
|
||||
from app.db import init_db
|
||||
from app.main import create_app
|
||||
from app.models.geo import GeoInfo
|
||||
from app.models.geo import GeoDetail, GeoInfo
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Fixtures
|
||||
@@ -71,7 +71,7 @@ class TestGeoLookup:
|
||||
|
||||
async def test_200_with_geo_info(self, geo_client: AsyncClient) -> None:
|
||||
"""GET /api/geo/lookup/{ip} returns 200 with enriched result."""
|
||||
geo = GeoInfo(country_code="DE", country_name="Germany", asn="12345", org="Acme")
|
||||
geo = GeoDetail(country_code="DE", country_name="Germany", asn="12345", org="Acme")
|
||||
result: dict[str, object] = {
|
||||
"ip": "1.2.3.4",
|
||||
"currently_banned_in": ["sshd"],
|
||||
@@ -97,7 +97,7 @@ class TestGeoLookup:
|
||||
result: dict[str, object] = {
|
||||
"ip": "8.8.8.8",
|
||||
"currently_banned_in": [],
|
||||
"geo": GeoInfo(country_code="US", country_name="United States", asn=None, org=None),
|
||||
"geo": GeoDetail(country_code="US", country_name="United States", asn=None, org=None),
|
||||
}
|
||||
with patch(
|
||||
"app.routers.geo.jail_service.lookup_ip",
|
||||
|
||||
Reference in New Issue
Block a user