feat: add tests for fingerprinting multiple ssh keys
This commit is contained in:
@@ -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())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
2
tests/fixtures/multiple_entries_authfile
vendored
Normal file
2
tests/fixtures/multiple_entries_authfile
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM7w9XepGj/eclXfAd/8bndayZyOCG0KOOfC8u5dkZ+R dri@home
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA/wbGoIUsbBHFbnXj2g+23C8sUgYkZTq0TrBm0MMWnx h@cafe
|
||||
Reference in New Issue
Block a user