feat: add test framework, unit tests, and GitLab CI pipeline #1

Merged
kfj001 merged 8 commits from feature/tests-and-ci into main 2026-07-29 15:40:31 -07:00
Showing only changes of commit 4e7ba7adea - Show all commits
+4 -2
View File
1
@@ -156,7 +156,8 @@ class TestLookupGeo:
lp._geo_reader = None
@patch("app.log_parser.settings")
def test_ip_maps_to_country(self, mock_settings):
@patch("app.log_parser.os.path.exists", return_value=True)
def test_ip_maps_to_country(self, mock_exists, mock_settings):
"""Verify a known IP resolves to a country code via the GeoLite2 reader."""
self._reset_geo_reader()
mock_settings.GEOLITE2_DB_PATH = "/tmp/fake-geo.mmdb"
@@ -179,7 +180,8 @@ class TestLookupGeo:
assert result["longitude"] == -74.006
@patch("app.log_parser.settings")
def test_ip_without_coordinates_uses_centroid_fallback(self, mock_settings):
@patch("app.log_parser.os.path.exists", return_value=True)
def test_ip_without_coordinates_uses_centroid_fallback(self, mock_exists, mock_settings):
"""When the free GeoLite2 DB lacks coordinates, centroid fallback kicks in."""
self._reset_geo_reader()
mock_settings.GEOLITE2_DB_PATH = "/tmp/fake-geo.mmdb"