Skip to content

Commit 032adb8

Browse files
committed
added test cases
1 parent 9b79c8b commit 032adb8

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

tests/handler_async_test.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,3 +148,15 @@ async def test_get_batch_details_total_timeout(batch_size):
148148
ips, batch_size=batch_size, timeout_total=0.001
149149
)
150150
await handler.deinit()
151+
152+
153+
#############
154+
# BOGON TESTS
155+
#############
156+
157+
158+
async def test_bogon_details():
159+
token = os.environ.get("IPINFO_TOKEN", "")
160+
handler = AsyncHandler(token)
161+
details = await handler.getDetails("127.0.0.1")
162+
assert details.all == {'bogon': True, 'ip': '127.0.0.1'}

tests/handler_test.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,16 @@ def test_get_map():
150150
handler = Handler()
151151
mapUrl = handler.getMap(open("tests/map-ips.txt").read().splitlines())
152152
print(f"got URL={mapUrl}")
153+
154+
155+
#############
156+
# BOGON TESTS
157+
#############
158+
159+
160+
def test_bogon_details():
161+
token = os.environ.get("IPINFO_TOKEN", "")
162+
handler = Handler(token)
163+
details = handler.getDetails("127.0.0.1")
164+
assert isinstance(details, Details)
165+
assert details.all == {'bogon': True, 'ip': '127.0.0.1'}

0 commit comments

Comments
 (0)