mirror of
https://github.com/bybrooklyn/openbitdo.git
synced 2026-03-19 12:12:57 -04:00
Bootstrap OpenBitdo clean-room SDK and reliability milestone
This commit is contained in:
23
sdk/tests/capability_gating.rs
Normal file
23
sdk/tests/capability_gating.rs
Normal file
@@ -0,0 +1,23 @@
|
||||
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:?}"),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user