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