tests: add tests for authfile
This commit is contained in:
@@ -35,3 +35,24 @@ pub enum Error {
|
||||
#[error("failed to parse entity: {0}")]
|
||||
PublicKeyParsing(#[from] crate::entity::Error),
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_read_nonexistent_file() {
|
||||
let nonexistent = Path::new("tests/fixtures/nonexistent.txt");
|
||||
match read(nonexistent).await {
|
||||
Err(Error::FileNotReadable(_)) => {}
|
||||
_ => panic!("reading nonexistent authfile succeded: should have failed"),
|
||||
};
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_valid_authfile() {
|
||||
read(Path::new("tests/fixtures/valid_authfile"))
|
||||
.await
|
||||
.expect("failed to read valid authfile fixture");
|
||||
}
|
||||
}
|
||||
|
||||
1
tests/fixtures/valid_authfile
vendored
Normal file
1
tests/fixtures/valid_authfile
vendored
Normal file
@@ -0,0 +1 @@
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA/wbGoIUsbBHFbnXj2g+23C8sUgYkZTq0TrBm0MMWnx h@cafe
|
||||
Reference in New Issue
Block a user