@@ -27,7 +27,7 @@ def test_get_ip_info(mock_client_class: Mock) -> None:
2727 assert result .ip_type == "ipv4"
2828 assert result .location .country == "United States"
2929 assert result .location .city == "Mountain View"
30- mock_client .get .assert_called_once_with ("/api/net-info/ ip/8.8.8.8" )
30+ mock_client .get .assert_called_once_with ("/ip/8.8.8.8" )
3131
3232
3333@patch ("hyphen.net_info.BaseClient" )
@@ -53,10 +53,12 @@ def test_get_ip_info_error(mock_client_class: Mock) -> None:
5353def test_get_ip_infos (mock_client_class : Mock ) -> None :
5454 """Test get_ip_infos method returns list of IpInfo."""
5555 mock_client = Mock ()
56- mock_client .post .return_value = [
57- {"ip" : "8.8.8.8" , "type" : "ipv4" , "location" : {"country" : "United States" }},
58- {"ip" : "1.1.1.1" , "type" : "ipv4" , "location" : {"country" : "Australia" }},
59- ]
56+ mock_client .post_raw .return_value = {
57+ "data" : [
58+ {"ip" : "8.8.8.8" , "type" : "ipv4" , "location" : {"country" : "United States" }},
59+ {"ip" : "1.1.1.1" , "type" : "ipv4" , "location" : {"country" : "Australia" }},
60+ ]
61+ }
6062 mock_client_class .return_value = mock_client
6163
6264 net_info = NetInfo (api_key = "key_123" )
@@ -69,20 +71,19 @@ def test_get_ip_infos(mock_client_class: Mock) -> None:
6971 assert isinstance (result [1 ], IpInfo )
7072 assert result [1 ].ip == "1.1.1.1"
7173 assert result [1 ].location .country == "Australia"
72- mock_client .post .assert_called_once_with (
73- "/api/net-info/ips" ,
74- data = {"ips" : ["8.8.8.8" , "1.1.1.1" ]}
75- )
74+ mock_client .post_raw .assert_called_once_with ("/ip" , data = ["8.8.8.8" , "1.1.1.1" ])
7675
7776
7877@patch ("hyphen.net_info.BaseClient" )
7978def test_get_ip_infos_with_errors (mock_client_class : Mock ) -> None :
8079 """Test get_ip_infos method handles mixed results with errors."""
8180 mock_client = Mock ()
82- mock_client .post .return_value = [
83- {"ip" : "8.8.8.8" , "type" : "ipv4" , "location" : {"country" : "United States" }},
84- {"ip" : "invalid" , "type" : "error" , "errorMessage" : "Invalid IP" },
85- ]
81+ mock_client .post_raw .return_value = {
82+ "data" : [
83+ {"ip" : "8.8.8.8" , "type" : "ipv4" , "location" : {"country" : "United States" }},
84+ {"ip" : "invalid" , "type" : "error" , "errorMessage" : "Invalid IP" },
85+ ]
86+ }
8687 mock_client_class .return_value = mock_client
8788
8889 net_info = NetInfo (api_key = "key_123" )
0 commit comments