mirror of
https://github.com/bybrooklyn/openbitdo.git
synced 2026-03-19 12:12:57 -04:00
24 lines
696 B
Rust
24 lines
696 B
Rust
use bitdo_proto::{BitdoError, DeviceSession, MockTransport, SessionConfig, VidPid};
|
|
|
|
#[test]
|
|
fn detect_only_pid_blocks_unsafe_operations() {
|
|
let transport = MockTransport::default();
|
|
let config = SessionConfig {
|
|
allow_unsafe: true,
|
|
brick_risk_ack: true,
|
|
experimental: true,
|
|
..SessionConfig::default()
|
|
};
|
|
|
|
let mut session =
|
|
DeviceSession::new(transport, VidPid::new(0x2dc8, 8448), config).expect("session init");
|
|
|
|
let err = session
|
|
.enter_bootloader()
|
|
.expect_err("must reject unsafe op");
|
|
match err {
|
|
BitdoError::UnsupportedForPid { .. } => {}
|
|
other => panic!("unexpected error: {other:?}"),
|
|
}
|
|
}
|