a826e5f7d3
FIFA 23 reverse-engineering proxy and integration scaffold. - Catch-all HTTP proxy that captures all incoming FIFA 23 traffic - Known-route mapper (speculative FUT paths → Core API calls) - Placeholder JSON responses for unmapped endpoints - Admin endpoints: GET /_bridge/captures, GET /_bridge/unknown - Capture persistence to captures/*.json for RE analysis - 4 unit tests passing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
49 lines
1.3 KiB
Rust
49 lines
1.3 KiB
Rust
use openfut_bridge::{capture::CapturedRequest, mapper::map_to_core};
|
|
|
|
#[test]
|
|
fn test_known_endpoint_maps_to_core() {
|
|
let mapping = map_to_core("POST", "/ut/auth");
|
|
assert!(mapping.is_some());
|
|
let m = mapping.unwrap();
|
|
assert_eq!(m.core_path, "/auth/local");
|
|
}
|
|
|
|
#[test]
|
|
fn test_unknown_endpoint_returns_none() {
|
|
let mapping = map_to_core("GET", "/ut/game/fut/some/unknown/path");
|
|
assert!(mapping.is_none());
|
|
}
|
|
|
|
#[test]
|
|
fn test_capture_serializes_cleanly() {
|
|
let capture = CapturedRequest::new(
|
|
"GET",
|
|
"/ut/game/fut/user/settings",
|
|
None,
|
|
vec![("user-agent".into(), "FIFA23/1.0".into())],
|
|
None,
|
|
);
|
|
|
|
let json = serde_json::to_string(&capture).expect("serialize");
|
|
let back: CapturedRequest = serde_json::from_str(&json).expect("deserialize");
|
|
assert_eq!(back.path, "/ut/game/fut/user/settings");
|
|
assert_eq!(back.method, "GET");
|
|
assert!(back.mapped_to_core.is_none());
|
|
assert!(back.response_status.is_none());
|
|
}
|
|
|
|
#[test]
|
|
fn test_capture_with_response() {
|
|
let capture = CapturedRequest::new(
|
|
"POST",
|
|
"/ut/auth",
|
|
None,
|
|
vec![],
|
|
Some(r#"{"token":"abc"}"#.into()),
|
|
)
|
|
.with_response(200, Some(r#"{"status":"ok"}"#.into()));
|
|
|
|
assert_eq!(capture.response_status, Some(200));
|
|
assert!(capture.response_body.is_some());
|
|
}
|