Skip to content

Commit bde6b91

Browse files
committed
fix: update proxy test assertions to match current MMDB data
45.77.77.77 no longer has is_proxy=true in the upstream database; it now reports is_tor=true instead.
1 parent ab66dba commit bde6b91

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

src/db.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use maxminddb::Reader;
99
use serde::Deserialize;
1010

1111
use crate::models::{
12-
IpInfo, MmdbAsn, MmdbCity, MmdbCountry, MmdbProxy, MmdbRecord, ProxyInfo, from_mmdb_record,
12+
from_mmdb_record, IpInfo, MmdbAsn, MmdbCity, MmdbCountry, MmdbProxy, MmdbRecord, ProxyInfo,
1313
};
1414

1515
pub type DbReader = Reader<Vec<u8>>;
@@ -194,7 +194,7 @@ mod tests {
194194
let proxy = lookup_proxy(&shared, ip);
195195
assert!(proxy.is_some());
196196
let proxy = proxy.unwrap();
197-
assert!(proxy.is_proxy);
197+
assert!(proxy.is_tor);
198198
assert!(proxy.is_anonymous);
199199
}
200200

tests/integration.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ async fn json_endpoint_returns_full_info() {
9393
);
9494
assert_eq!(json["country"]["iso_code"], "US");
9595
assert_eq!(json["city"]["names"]["en"], "Piscataway");
96-
assert_eq!(json["proxy"]["is_proxy"], true);
96+
assert_eq!(json["proxy"]["is_proxy"], false);
9797
assert_eq!(json["proxy"]["is_hosting"], false);
98-
assert_eq!(json["proxy"]["is_tor"], false);
98+
assert_eq!(json["proxy"]["is_tor"], true);
9999
}
100100

101101
#[tokio::test]
@@ -154,7 +154,7 @@ async fn proxy_endpoint() {
154154
let app = build_test_app();
155155
let (status, body) = get(&app, "/proxy?ip=45.77.77.77").await;
156156
assert_eq!(status, StatusCode::OK);
157-
assert_eq!(body.trim(), "true");
157+
assert_eq!(body.trim(), "false");
158158
}
159159

160160
#[tokio::test]
@@ -178,7 +178,7 @@ async fn tor_endpoint() {
178178
let app = build_test_app();
179179
let (status, body) = get(&app, "/tor?ip=45.77.77.77").await;
180180
assert_eq!(status, StatusCode::OK);
181-
assert_eq!(body.trim(), "false");
181+
assert_eq!(body.trim(), "true");
182182
}
183183

184184
#[tokio::test]

0 commit comments

Comments
 (0)