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