blob: c63c2d6259ac27364c99f6bdae15ee6d8dc0224b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
import pytest
from ..config import GEOIP_CITY_PATH
from ..geo import get_location
geoip_required = pytest.mark.skipif(
not GEOIP_CITY_PATH, reason="Path to GeoLite2 city database must be provided"
)
@geoip_required
def test_geo():
ip = "2.52.2.52"
location = get_location(ip)
assert location.latitude == 31.5
assert location.longitude == 34.75
assert location.time_zone == "Asia/Jerusalem"
@geoip_required
def test_geo_localhost():
ip = "127.0.0.1"
location = get_location(ip)
assert location.latitude == 34.7641
assert location.longitude == 32.0669
assert location.time_zone == "Asia/Jerusalem"
|