@@ -30,74 +30,99 @@ end_per_suite(_Config) ->
3030details_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+
55+ % latitude => <<"38.0088">>,loc => <<"38.0088,-122.1175">>,
56+ % longitude => <<"-122.1175">>,org => <<"AS15169 Google LLC">>,
57+ % postal => <<"94043">>,region => <<"California">>,
58+ % timezone => <<"America/Los_Angeles">>,
59+ % <<"abuse">> =>
60+ % #{address =>
61+ % <<"US, CA, Mountain View, 1600 Amphitheatre Parkway, 94043">>,
62+ % country => <<"US">>,
63+ % email => <<"network-abuse@google.com">>,
64+ % name => <<"Abuse">>,<<"network">> => <<"8.8.8.0/24">>,
65+ % <<"phone">> => <<"+1-650-253-0000">>},
66+ % <<"asn">> =>
67+ % #{domain => <<"google.com">>,name => <<"Google LLC">>,
68+ % type => <<"hosting">>,<<"asn">> => <<"AS15169">>,
69+ % <<"route">> => <<"8.8.8.0/24">>},
70+ % <<"company">> =>
71+ % #{domain => <<"google.com">>,name => <<"Google LLC">>,
72+ % type => <<"hosting">>},
73+ % <<"domains">> =>
74+ % #{ip => <<"8.8.8.8">>,total => 15669,
75+ % <<"domains">> =>
76+ % [<<"hdchina.org">>,<<"musicool.cn">>,
77+ % <<"ztgg.org">>,<<"itempurl.com">>,
78+ % <<"authrock.com">>]},
79+ % <<"is_anycast">> => true,<<"is_hosting">> => true,
80+ % <<"is_mobile">> => false,<<"is_satellite">> => false,
81+ % <<"privacy">> =>
82+ % #{proxy => false,relay => false,service => <<>>,
83+ % <<"hosting">> => true,<<"tor">> => false,
84+ % <<"vpn">> => false}}}}, continent =>
85+ % #{<<"code">> => <<"NA">>,
86+ % <<"name">> => <<"North America">>},
87+ % country => <<"US">>,
88+ % country_currency =>
89+ % #{<<"code">> => <<"USD">>,<<"symbol">> => <<"$">>},
90+ % country_flag =>
91+ % #{<<"emoji">> => <<240,159,135,186,240,159,135,184>>,
92+ % <<"unicode">> => <<"U+1F1FA U+1F1F8">>},
93+ % country_flag_url =>
94+ % <<"https:/cdn.ipinfo.io/static/images/countries-flags/US.svg">>,
95+ % country_name => <<"United States">>,
96+ % hostname => <<"dns.google">>,ip => <<"8.8.8.8">>,
97+ % is_anonymous => false,is_eu => false,
98+ % latitude => <<"38.0088">>,loc => <<"38.0088,-122.1175">>,
99+ % longitude => <<"-122.1175">>,org => <<"AS15169 Google LLC">>,
100+ % postal => <<"94043">>,region => <<"California">>,
101+ % timezone => <<"America/Los_Angeles">>,
102+ % <<"abuse">> =>
103+ % #{address =>
104+ % <<"US, CA, Mountain View, 1600 Amphitheatre Parkway, 94043">>,
105+ % country => <<"US">>,
106+ % email => <<"network-abuse@google.com">>,
107+ % name => <<"Abuse">>,<<"network">> => <<"8.8.8.0/24">>,
108+ % <<"phone">> => <<"+1-650-253-0000">>},
109+ % <<"asn">> =>
110+ % #{domain => <<"google.com">>,name => <<"Google LLC">>,
111+ % type => <<"hosting">>,<<"asn">> => <<"AS15169">>,
112+ % <<"route">> => <<"8.8.8.0/24">>},
113+ % <<"company">> =>
114+ % #{domain => <<"google.com">>,name => <<"Google LLC">>,
115+ % type => <<"hosting">>},
116+ % <<"domains">> =>
117+ % #{ip => <<"8.8.8.8">>,total => 15669,
118+ % <<"domains">> =>
119+ % [<<"hdchina.org">>,<<"musicool.cn">>,
120+ % <<"ztgg.org">>,<<"itempurl.com">>,
121+ % <<"authrock.com">>]},
122+ % <<"is_anycast">> => true,<<"is_hosting">> => true,
123+ % <<"is_mobile">> => false,<<"is_satellite">> => false,
124+ % <<"privacy">> =>
125+ % #{proxy => false,relay => false,service => <<>>,
126+ % <<"hosting">> => true,<<"tor">> => false,
127+ % <<"vpn">> => false}}}},
128+
0 commit comments