Skip to content

Commit d0af22d

Browse files
oschwaldclaude
andcommitted
Add anonymizer property tests for IPAddress model
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 1d8bed8 commit d0af22d

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

tests/data/factors-response.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@
1919
"reason": "Suspicious activity has been seen on this IP address across minFraud customers."
2020
}
2121
],
22+
"anonymizer": {
23+
"confidence": 99,
24+
"is_anonymous": true,
25+
"is_anonymous_vpn": true,
26+
"is_hosting_provider": true,
27+
"is_public_proxy": true,
28+
"is_residential_proxy": true,
29+
"is_tor_exit_node": true,
30+
"network_last_seen": "2025-01-15",
31+
"provider_name": "TestVPN"
32+
},
2233
"city": {
2334
"confidence": 42,
2435
"geoname_id": 2643743,

tests/data/insights-response.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@
1919
"reason": "Suspicious activity has been seen on this IP address across minFraud customers."
2020
}
2121
],
22+
"anonymizer": {
23+
"confidence": 99,
24+
"is_anonymous": true,
25+
"is_anonymous_vpn": true,
26+
"is_hosting_provider": true,
27+
"is_public_proxy": true,
28+
"is_residential_proxy": true,
29+
"is_tor_exit_node": true,
30+
"network_last_seen": "2025-01-15",
31+
"provider_name": "TestVPN"
32+
},
2233
"city": {
2334
"confidence": 42,
2435
"geoname_id": 2643743,

tests/test_models.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import datetime
34
import unittest
45
from typing import Any
56

@@ -187,6 +188,16 @@ def test_ip_address(self) -> None:
187188
"across minFraud customers.",
188189
},
189190
],
191+
anonymizer={
192+
"confidence": 99,
193+
"is_anonymous": True,
194+
"is_anonymous_vpn": True,
195+
"is_hosting_provider": True,
196+
"is_public_proxy": True,
197+
"is_tor_exit_node": True,
198+
"network_last_seen": "2025-01-15",
199+
"provider_name": "TestVPN",
200+
},
190201
traits={
191202
"is_anonymous": True,
192203
"is_anonymous_proxy": True,
@@ -215,6 +226,18 @@ def test_ip_address(self) -> None:
215226
self.assertEqual("310", address.traits.mobile_country_code)
216227
self.assertEqual("004", address.traits.mobile_network_code)
217228

229+
# Test anonymizer attribute
230+
self.assertEqual(99, address.anonymizer.confidence)
231+
self.assertEqual(True, address.anonymizer.is_anonymous)
232+
self.assertEqual(True, address.anonymizer.is_anonymous_vpn)
233+
self.assertEqual(True, address.anonymizer.is_hosting_provider)
234+
self.assertEqual(True, address.anonymizer.is_public_proxy)
235+
self.assertEqual(True, address.anonymizer.is_tor_exit_node)
236+
self.assertEqual(
237+
datetime.date(2025, 1, 15), address.anonymizer.network_last_seen
238+
)
239+
self.assertEqual("TestVPN", address.anonymizer.provider_name)
240+
218241
self.assertEqual("ANONYMOUS_IP", address.risk_reasons[0].code)
219242
self.assertEqual(
220243
"The IP address belongs to an anonymous network. "

0 commit comments

Comments
 (0)