Skip to content

Commit adbe38d

Browse files
committed
details_test: update 8.8.8.8 details
1 parent 6d2b2ae commit adbe38d

File tree

1 file changed

+69
-71
lines changed

1 file changed

+69
-71
lines changed

test/ipinfo_SUITE.erl

Lines changed: 69 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -30,74 +30,72 @@ end_per_suite(_Config) ->
3030
details_test(Config) ->
3131
Token = proplists:get_value(token, Config),
3232
{ok, IpInfo} = ipinfo:create(Token),
33-
{ok, #{
34-
ip := <<"8.8.8.8">>,
35-
loc := <<"37.4056,-122.0775">>,
36-
hostname := <<"dns.google">>,
37-
city := <<"Mountain View">>,
38-
region := <<"California">>,
39-
country := <<"US">>,
40-
org := <<"AS15169 Google LLC">>,
41-
postal := <<"94043">>,
42-
timezone := <<"America/Los_Angeles">>,
43-
country_name := <<"United States">>,
44-
latitude := <<"37.4056">>,
45-
longitude := <<"-122.0775">>,
46-
is_eu := false,
47-
country_flag := #{
48-
<<"emoji">> := <<240,159,135,186,240,159,135,184>>,
49-
<<"unicode">> := <<"U+1F1FA U+1F1F8">>
50-
},
51-
country_currency := #{
52-
<<"code">> := <<"USD">>,
53-
<<"symbol">> := <<"$">>
54-
},
55-
continent := #{
56-
<<"code">> := <<"NA">>,
57-
<<"name">> := <<"North America">>
58-
},
59-
country_flag_url := <<"https:/cdn.ipinfo.io/static/images/countries-flags/US.svg">>,
60-
is_anonymous := false,
61-
<<"abuse">> := #{
62-
name := <<"Abuse">>,
63-
address := <<"US, CA, Mountain View, 1600 Amphitheatre Parkway, 94043">>,
64-
country := <<"US">>,
65-
email := <<"network-abuse@google.com">>,
66-
<<"network">> := <<"8.8.8.0/24">>,
67-
<<"phone">> := <<"+1-650-253-0000">>
68-
},
69-
<<"asn">> := #{
70-
name := <<"Google LLC">>,
71-
type := <<"hosting">>,
72-
domain := <<"google.com">>,
73-
<<"asn">> := <<"AS15169">>,
74-
<<"route">> := <<"8.8.8.0/24">>
75-
},
76-
<<"company">> := #{
77-
name := <<"Google LLC">>,
78-
type := <<"hosting">>,
79-
domain := <<"google.com">>
80-
},
81-
<<"domains">> := #{
82-
total := 15669,ip := <<"8.8.8.8">>,
83-
<<"domains">> :=[
84-
<<"hdchina.org">>,
85-
<<"musicool.cn">>,
86-
<<"ztgg.org">>,
87-
<<"itempurl.com">>,
88-
<<"authrock.com">>
89-
]
90-
},
91-
<<"is_anycast">> := true,
92-
<<"is_hosting">> := true,
93-
<<"is_mobile">> := false,
94-
<<"is_satellite">> := false,
95-
<<"privacy">> := #{
96-
service := <<>>,
97-
proxy := false,
98-
relay := false,
99-
<<"hosting">> := true,
100-
<<"tor">> := false,
101-
<<"vpn">> := false
102-
}
103-
}} = ipinfo:details(IpInfo, <<"8.8.8.8">>).
33+
{ok, Details}= ipinfo:details(IpInfo, <<"8.8.8.8">>),
34+
?assertEqual(<<"Mountain View">>, maps:get(city, Details)),
35+
?assertEqual(#{
36+
<<"code">> => <<"NA">>,
37+
<<"name">> => <<"North America">>
38+
}, maps:get(continent, Details)),
39+
?assertEqual(<<"US">>, maps:get(country, Details)),
40+
?assertEqual(#{
41+
<<"code">> => <<"USD">>,
42+
<<"symbol">> => <<"$">>
43+
}, maps:get(country_currency, Details)),
44+
?assertEqual(#{
45+
<<"emoji">> => <<240,159,135,186,240,159,135,184>>,
46+
<<"unicode">> => <<"U+1F1FA U+1F1F8">>
47+
}, maps:get(country_flag, Details)),
48+
?assertEqual(<<"https:/cdn.ipinfo.io/static/images/countries-flags/US.svg">>, maps:get(country_flag_url, Details)),
49+
?assertEqual(<<"United States">>, maps:get(country_name, Details)),
50+
?assertEqual(<<"dns.google">>, maps:get(hostname, Details)),
51+
?assertEqual(<<"8.8.8.8">>, maps:get(ip, Details)),
52+
?assertEqual(false, maps:get(is_anonymous, Details)),
53+
?assertEqual(false, maps:get(is_eu, Details)),
54+
?assertEqual(<<"38.0088">>, maps:get(latitude, Details)),
55+
?assertEqual(<<"38.0088,-122.1175">>, maps:get(loc, Details)),
56+
?assertEqual(<<"-122.1175">>, maps:get(longitude, Details)),
57+
?assertEqual(<<"AS15169 Google LLC">>, maps:get(org, Details)),
58+
?assertEqual(<<"94043">>, maps:get(postal, Details)),
59+
?assertEqual(<<"California">>, maps:get(region, Details)),
60+
?assertEqual(<<"America/Los_Angeles">>, maps:get(timezone, Details)),
61+
?assertEqual(#{
62+
address => <<"US, CA, Mountain View, 1600 Amphitheatre Parkway, 94043">>,
63+
country => <<"US">>,
64+
email => <<"network-abuse@google.com">>,
65+
name => <<"Abuse">>,<<"network">> => <<"8.8.8.0/24">>,
66+
<<"phone">> => <<"+1-650-253-0000">>
67+
}, maps:get(<<"abuse">>, Details)),
68+
?assertEqual(#{
69+
domain => <<"google.com">>,
70+
name => <<"Google LLC">>,
71+
type => <<"hosting">>,
72+
<<"asn">> => <<"AS15169">>,
73+
<<"route">> => <<"8.8.8.0/24">>
74+
}, maps:get(<<"asn">>, Details)),
75+
?assertEqual(#{
76+
domain => <<"google.com">>,
77+
name => <<"Google LLC">>,
78+
type => <<"hosting">>
79+
}, maps:get(<<"company">>, Details)),
80+
?assertEqual(#{
81+
ip => <<"8.8.8.8">>,
82+
total => 15669,
83+
<<"domains">> => [
84+
<<"hdchina.org">>,
85+
<<"musicool.cn">>,
86+
<<"ztgg.org">>,
87+
<<"itempurl.com">>,
88+
<<"authrock.com">>]
89+
}, maps:get(<<"domains">>, Details)),
90+
?assertEqual(true, maps:get(<<"is_anycast">>, Details)),
91+
?assertEqual(true, maps:get(<<"is_hosting">>, Details)),
92+
?assertEqual(false, maps:get(<<"is_mobile">>, Details)),
93+
?assertEqual(false, maps:get(<<"is_satellite">>, Details)),
94+
?assertEqual(#{
95+
proxy => false,
96+
relay => false,
97+
service => <<>>,
98+
<<"hosting">> => true,
99+
<<"tor">> => false,
100+
<<"vpn">> => false
101+
}, maps:get(<<"privacy">>, Details)).

0 commit comments

Comments
 (0)