feat: add tests for fingerprinting multiple ssh keys

This commit is contained in:
Himadri Bhattacharjee
2025-12-01 09:46:26 +05:30
parent c57328ef5b
commit 155f72ad64
2 changed files with 20 additions and 0 deletions

View File

@@ -55,4 +55,22 @@ mod tests {
.await
.expect("failed to read valid authfile fixture");
}
#[tokio::test]
async fn test_authfile_multiple_entries() {
let authfile = read(Path::new("tests/fixtures/multiple_entries_authfile"))
.await
.expect("failed to read authfile with multiple entries");
assert_eq!(authfile.entities.len(), 2);
let fingerprints = [
"SHA256:Ps6A7BicnJXgw9YM1kkN3hmDiuRG5KTD03IQ7czGalY",
"SHA256:Fbq5FVTRTm/FKKKTQcQXetbt6FKwTmQUBKjCIsUWZYA",
];
for (entity, fingerprint) in authfile.entities.iter().zip(fingerprints) {
assert_eq!(fingerprint, entity.fingerprint())
}
}
}

View File

@@ -0,0 +1,2 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM7w9XepGj/eclXfAd/8bndayZyOCG0KOOfC8u5dkZ+R dri@home
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA/wbGoIUsbBHFbnXj2g+23C8sUgYkZTq0TrBm0MMWnx h@cafe