Skip to content

Commit

Permalink
add batch test case for sync handler
Browse files Browse the repository at this point in the history
  • Loading branch information
UmanShahzad committed Nov 6, 2020
1 parent 88b35cd commit 3132948
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/handler_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,27 @@ def test_get_details(n):
assert len(domains["domains"]) == 5


@pytest.mark.parametrize("n", range(5))
def test_get_batch_details(n):
token = os.environ.get("IPINFO_TOKEN", "")
handler = Handler(token)
ips = ["1.1.1.1", "8.8.8.8", "9.9.9.9"]
details = handler.getBatchDetails(ips)

for ip in ips:
assert ip in details
d = details[ip]
assert d["ip"] == ip
assert d["country"] == "US"
assert d["country_name"] == "United States"
if token:
assert "asn" in d
assert "company" in d
assert "privacy" in d
assert "abuse" in d
assert "domains" in d


def test_builtin_ip_types():
handler = Handler()
fake_details = {"country": "US", "ip": "127.0.0.1", "loc": "12.34,56.78"}
Expand Down

0 comments on commit 3132948

Please sign in to comment.