
* format files Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix pyright Signed-off-by: Jens Langhammer <jens@goauthentik.io> * revert #8367 Signed-off-by: Jens Langhammer <jens@goauthentik.io> * sigh Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io>
28 lines
731 B
Python
28 lines
731 B
Python
"""Test GeoIP Wrapper"""
|
|
|
|
from django.test import TestCase
|
|
|
|
from authentik.events.context_processors.geoip import GeoIPContextProcessor
|
|
|
|
|
|
class TestGeoIP(TestCase):
|
|
"""Test GeoIP Wrapper"""
|
|
|
|
def setUp(self) -> None:
|
|
self.reader = GeoIPContextProcessor()
|
|
|
|
def test_simple(self):
|
|
"""Test simple city wrapper"""
|
|
# IPs from
|
|
# https://github.com/maxmind/MaxMind-DB/blob/main/source-data/GeoLite2-City-Test.json
|
|
self.assertEqual(
|
|
self.reader.city_dict("2.125.160.216"),
|
|
{
|
|
"city": "Boxford",
|
|
"continent": "EU",
|
|
"country": "GB",
|
|
"lat": 51.75,
|
|
"long": -1.25,
|
|
},
|
|
)
|