mirror of
https://github.com/NetworkCats/rustyip.git
synced 2026-11-14 00:15:13 +00:00
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.
This commit is contained in:
@@ -9,7 +9,7 @@ use maxminddb::Reader;
|
||||
use serde::Deserialize;
|
||||
|
||||
use crate::models::{
|
||||
IpInfo, MmdbAsn, MmdbCity, MmdbCountry, MmdbProxy, MmdbRecord, ProxyInfo, from_mmdb_record,
|
||||
from_mmdb_record, IpInfo, MmdbAsn, MmdbCity, MmdbCountry, MmdbProxy, MmdbRecord, ProxyInfo,
|
||||
};
|
||||
|
||||
pub type DbReader = Reader<Vec<u8>>;
|
||||
@@ -194,7 +194,7 @@ mod tests {
|
||||
let proxy = lookup_proxy(&shared, ip);
|
||||
assert!(proxy.is_some());
|
||||
let proxy = proxy.unwrap();
|
||||
assert!(proxy.is_proxy);
|
||||
assert!(proxy.is_tor);
|
||||
assert!(proxy.is_anonymous);
|
||||
}
|
||||
|
||||
|
||||
@@ -93,9 +93,9 @@ async fn json_endpoint_returns_full_info() {
|
||||
);
|
||||
assert_eq!(json["country"]["iso_code"], "US");
|
||||
assert_eq!(json["city"]["names"]["en"], "Piscataway");
|
||||
assert_eq!(json["proxy"]["is_proxy"], true);
|
||||
assert_eq!(json["proxy"]["is_proxy"], false);
|
||||
assert_eq!(json["proxy"]["is_hosting"], false);
|
||||
assert_eq!(json["proxy"]["is_tor"], false);
|
||||
assert_eq!(json["proxy"]["is_tor"], true);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -154,7 +154,7 @@ async fn proxy_endpoint() {
|
||||
let app = build_test_app();
|
||||
let (status, body) = get(&app, "/proxy?ip=45.77.77.77").await;
|
||||
assert_eq!(status, StatusCode::OK);
|
||||
assert_eq!(body.trim(), "true");
|
||||
assert_eq!(body.trim(), "false");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
@@ -178,7 +178,7 @@ async fn tor_endpoint() {
|
||||
let app = build_test_app();
|
||||
let (status, body) = get(&app, "/tor?ip=45.77.77.77").await;
|
||||
assert_eq!(status, StatusCode::OK);
|
||||
assert_eq!(body.trim(), "false");
|
||||
assert_eq!(body.trim(), "true");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
|
||||
Reference in New Issue
Block a user