Skip to content

Commit

Permalink
Clean up: remove unused tests, etc
Browse files Browse the repository at this point in the history
  • Loading branch information
elizabethengelman committed Mar 20, 2024
1 parent 852114e commit db1c976
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 34 deletions.
3 changes: 1 addition & 2 deletions cmd/crates/stellar-ledger/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub enum LedgerError {

pub fn get_public_key(index: u32) -> Result<stellar_strkey::ed25519::PublicKey, LedgerError> {
let hd_path = bip_path_from_index(index);
get_public_key_with_display_flag(hd_path, true)
get_public_key_with_display_flag(hd_path, false)
}

fn bip_path_from_index(index: u32) -> slip10::BIP32Path {
Expand Down Expand Up @@ -90,7 +90,6 @@ pub fn get_public_key_with_display_flag(
response.retcode(),
);
// Ok means we successfully connected with the Ledger but it doesn't mean our request succeeded. We still need to check the response.retcode

if response.retcode() == RETURN_CODE_OK {
return Ok(
stellar_strkey::ed25519::PublicKey::from_payload(&response.data()).unwrap(),
Expand Down
33 changes: 1 addition & 32 deletions cmd/crates/stellar-ledger/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,42 +36,11 @@ mod test {
&HIDAPI
}

#[test]
#[serial]
fn list_all_devices() {
init_logging();
let api = hidapi();

for device_info in api.device_list() {
println!(
"{:#?} - {:#x}/{:#x}/{:#x}/{:#x} {:#} {:#}",
device_info.path(),
device_info.vendor_id(),
device_info.product_id(),
device_info.usage_page(),
device_info.interface_number(),
device_info.manufacturer_string().unwrap_or_default(),
device_info.product_string().unwrap_or_default()
);
}
}

#[test]
#[serial]
fn ledger_device_path() {
init_logging();
let api = hidapi();

let mut ledgers = TransportNativeHID::list_ledgers(&api);

let a_ledger = ledgers.next().expect("could not find any ledger device");
println!("{:?}", a_ledger.path());
}

#[test]
#[serial]
fn test_get_public_key() {
let public_key = get_public_key(0);
println!("{public_key:?}");
assert!(public_key.is_ok());
}
}

0 comments on commit db1c976

Please sign in to comment.