@@ -75,9 +75,6 @@ def test_get_private_ipv4_exception():
7575 assert result ["error" ] == "Test error"
7676
7777
78-
79-
80-
8178def test_public_ipv4_auto_timeout_error ():
8279 result = get_public_ipv4 (api = IPv4API .AUTO , geo = True , timeout = "5" )
8380 assert not result ["status" ]
@@ -90,9 +87,6 @@ def test_public_ipv4_auto_net_error():
9087 assert result ["error" ] == "All attempts failed."
9188
9289
93-
94-
95-
9690def test_public_ipv4_auto_safe_timeout_error ():
9791 result = get_public_ipv4 (api = IPv4API .AUTO_SAFE , geo = True , timeout = "5" )
9892 assert not result ["status" ]
@@ -105,9 +99,6 @@ def test_public_ipv4_auto_safe_net_error():
10599 assert result ["error" ] == "All attempts failed."
106100
107101
108-
109-
110-
111102def test_public_ipv4_ipapi_co_timeout_error ():
112103 result = get_public_ipv4 (api = IPv4API .IPAPI_CO , geo = True , timeout = "5" )
113104 assert not result ["status" ]
@@ -120,9 +111,6 @@ def test_public_ipv4_ipapi_co_net_error():
120111 assert result ["error" ] == "No Internet"
121112
122113
123-
124-
125-
126114def test_public_ipv4_ipleak_net_timeout_error ():
127115 result = get_public_ipv4 (api = IPv4API .IPLEAK_NET , geo = True , timeout = "5" )
128116 assert not result ["status" ]
@@ -135,9 +123,6 @@ def test_public_ipv4_ipleak_net_net_error():
135123 assert result ["error" ] == "No Internet"
136124
137125
138-
139-
140-
141126def test_public_ipv4_my_ip_io_timeout_error ():
142127 result = get_public_ipv4 (api = IPv4API .MY_IP_IO , geo = True , timeout = "5" )
143128 assert not result ["status" ]
@@ -150,9 +135,6 @@ def test_public_ipv4_my_ip_io_net_error():
150135 assert result ["error" ] == "No Internet"
151136
152137
153-
154-
155-
156138def test_public_ipv4_ifconfig_co_timeout_error ():
157139 result = get_public_ipv4 (api = IPv4API .IFCONFIG_CO , geo = True , timeout = "5" )
158140 assert not result ["status" ]
@@ -165,9 +147,6 @@ def test_public_ipv4_ifconfig_co_net_error():
165147 assert result ["error" ] == "No Internet"
166148
167149
168-
169-
170-
171150def test_public_ipv4_myip_la_timeout_error ():
172151 result = get_public_ipv4 (api = IPv4API .MYIP_LA , geo = True , timeout = "5" )
173152 assert not result ["status" ]
@@ -180,9 +159,6 @@ def test_public_ipv4_myip_la_net_error():
180159 assert result ["error" ] == "No Internet"
181160
182161
183-
184-
185-
186162def test_public_ipv4_ipquery_io_timeout_error ():
187163 result = get_public_ipv4 (api = IPv4API .IPQUERY_IO , geo = True , timeout = "5" )
188164 assert not result ["status" ]
@@ -195,9 +171,6 @@ def test_public_ipv4_ipquery_io_net_error():
195171 assert result ["error" ] == "No Internet"
196172
197173
198-
199-
200-
201174def test_public_ipv4_ipwho_is_timeout_error ():
202175 result = get_public_ipv4 (api = IPv4API .IPWHO_IS , geo = True , timeout = "5" )
203176 assert not result ["status" ]
@@ -210,9 +183,6 @@ def test_public_ipv4_ipwho_is_net_error():
210183 assert result ["error" ] == "No Internet"
211184
212185
213-
214-
215-
216186def test_public_ipv4_freeipapi_com_timeout_error ():
217187 result = get_public_ipv4 (api = IPv4API .FREEIPAPI_COM , geo = True , timeout = "5" )
218188 assert not result ["status" ]
@@ -225,9 +195,6 @@ def test_public_ipv4_freeipapi_com_net_error():
225195 assert result ["error" ] == "No Internet"
226196
227197
228-
229-
230-
231198def test_public_ipv4_ip_api_com_timeout_error ():
232199 result = get_public_ipv4 (api = IPv4API .IP_API_COM , geo = True , timeout = "5" )
233200 assert not result ["status" ]
@@ -240,9 +207,6 @@ def test_public_ipv4_ip_api_com_net_error():
240207 assert result ["error" ] == "No Internet"
241208
242209
243-
244-
245-
246210def test_public_ipv4_ipinfo_io_timeout_error ():
247211 result = get_public_ipv4 (api = IPv4API .IPINFO_IO , geo = True , timeout = "5" )
248212 assert not result ["status" ]
@@ -255,25 +219,18 @@ def test_public_ipv4_ipinfo_io_net_error():
255219 assert result ["error" ] == "No Internet"
256220
257221
258-
259-
260-
261222def test_public_ipv4_ip_sb_timeout_error ():
262223 result = get_public_ipv4 (api = IPv4API .IP_SB , geo = True , timeout = "5" )
263224 assert not result ["status" ]
264225
265226
266-
267227def test_public_ipv4_ip_sb_net_error ():
268228 with mock .patch .object (requests .Session , "get" , side_effect = Exception ("No Internet" )):
269229 result = get_public_ipv4 (api = IPv4API .IP_SB )
270230 assert not result ["status" ]
271231 assert result ["error" ] == "No Internet"
272232
273233
274-
275-
276-
277234def test_public_ipv4_ident_me_timeout_error ():
278235 result = get_public_ipv4 (api = IPv4API .IDENT_ME , geo = True , timeout = "5" )
279236 assert not result ["status" ]
@@ -286,9 +243,6 @@ def test_public_ipv4_ident_me_net_error():
286243 assert result ["error" ] == "No Internet"
287244
288245
289-
290-
291-
292246def test_public_ipv4_tnedi_me_timeout_error ():
293247 result = get_public_ipv4 (api = IPv4API .TNEDI_ME , geo = True , timeout = "5" )
294248 assert not result ["status" ]
@@ -307,9 +261,6 @@ def test_public_ipv4_api_error():
307261 assert result ["error" ] == "Unsupported API: api1"
308262
309263
310-
311-
312-
313264def test_public_ipv4_reallyfreegeoip_org_timeout_error ():
314265 result = get_public_ipv4 (api = IPv4API .REALLYFREEGEOIP_ORG , geo = True , timeout = "5" )
315266 assert not result ["status" ]
@@ -322,8 +273,6 @@ def test_public_ipv4_reallyfreegeoip_org_net_error():
322273 assert result ["error" ] == "No Internet"
323274
324275
325-
326-
327276def test_public_ipv4_wtfismyip_com_timeout_error ():
328277 result = get_public_ipv4 (api = IPv4API .WTFISMYIP_COM , geo = True , timeout = "5" )
329278 assert not result ["status" ]
@@ -334,3 +283,15 @@ def test_public_ipv4_wtfismyip_com_net_error():
334283 result = get_public_ipv4 (api = IPv4API .WTFISMYIP_COM )
335284 assert not result ["status" ]
336285 assert result ["error" ] == "No Internet"
286+
287+
288+ def test_public_ipv4_db_ip_com_timeout_error ():
289+ result = get_public_ipv4 (api = IPv4API .DB_IP_COM , geo = True , timeout = "5" )
290+ assert not result ["status" ]
291+
292+
293+ def test_public_ipv4_db_ip_com_net_error ():
294+ with mock .patch .object (requests .Session , "get" , side_effect = Exception ("No Internet" )):
295+ result = get_public_ipv4 (api = IPv4API .DB_IP_COM )
296+ assert not result ["status" ]
297+ assert result ["error" ] == "No Internet"
0 commit comments