@@ -41,12 +41,12 @@ pub mod types;
4141
4242#[ cfg( test) ]
4343mod tests {
44- use crate :: types:: { self , HWIDeviceType , TESTNET } ;
44+ use crate :: types:: { self , HWIChain , HWIDevice , HWIDeviceType , TESTNET } ;
4545 use crate :: HWIClient ;
4646 use std:: collections:: BTreeMap ;
4747 use std:: str:: FromStr ;
4848
49- use bitcoin:: bip32:: { DerivationPath , KeySource } ;
49+ use bitcoin:: bip32:: { DerivationPath , Fingerprint , KeySource } ;
5050 use bitcoin:: locktime:: absolute;
5151 use bitcoin:: psbt:: { Input , Output } ;
5252 use bitcoin:: { secp256k1, Transaction } ;
@@ -435,6 +435,41 @@ mod tests {
435435 }
436436 }
437437
438+ #[ test]
439+ #[ serial]
440+ #[ ignore = "Needs a Trezor One device for the test" ]
441+ fn test_prompt_pin_to_trezor_device ( ) {
442+ let client = HWIClient :: find_device (
443+ None ,
444+ Some ( HWIDeviceType :: Trezor ) ,
445+ None ,
446+ false ,
447+ Network :: Testnet ,
448+ )
449+ . unwrap ( ) ;
450+ client. prompt_pin ( ) . unwrap ( ) ;
451+ }
452+
453+ #[ test]
454+ #[ serial]
455+ #[ ignore = "Needs a Trezor One device for the test" ]
456+ fn test_send_pin_to_trezor_device ( ) {
457+ let client = HWIClient :: get_client (
458+ & HWIDevice {
459+ device_type : HWIDeviceType :: Trezor ,
460+ model : "trezor_1" . to_string ( ) ,
461+ path : "webusb:000:1:2" . to_string ( ) ,
462+ needs_pin_sent : true ,
463+ needs_passphrase_sent : false ,
464+ fingerprint : Fingerprint :: from_str ( "00000000" ) . unwrap ( ) ,
465+ } ,
466+ false ,
467+ HWIChain :: from ( Network :: Testnet ) ,
468+ )
469+ . unwrap ( ) ;
470+ client. send_pin ( "123456" ) . unwrap ( ) ;
471+ }
472+
438473 #[ test]
439474 #[ serial]
440475 #[ ignore]
0 commit comments