Clippy
This commit is contained in:
parent
e746a0b03f
commit
2d10ddb9fa
@ -561,7 +561,7 @@ mod tests {
|
|||||||
use once_cell::sync::Lazy;
|
use once_cell::sync::Lazy;
|
||||||
use openssl::{hash::MessageDigest, pkey::PKey, rsa::Rsa};
|
use openssl::{hash::MessageDigest, pkey::PKey, rsa::Rsa};
|
||||||
|
|
||||||
static MY_SIGNER: Lazy<MySigner> = Lazy::new(|| MySigner::new());
|
static MY_SIGNER: Lazy<MySigner> = Lazy::new(MySigner::new);
|
||||||
|
|
||||||
struct MySigner {
|
struct MySigner {
|
||||||
public_key: String,
|
public_key: String,
|
||||||
@ -596,7 +596,7 @@ mod tests {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
let mut verifier = openssl::sign::Verifier::new(MessageDigest::sha256(), &key).unwrap();
|
let mut verifier = openssl::sign::Verifier::new(MessageDigest::sha256(), &key).unwrap();
|
||||||
verifier.update(data.as_bytes()).unwrap();
|
verifier.update(data.as_bytes()).unwrap();
|
||||||
verifier.verify(&signature).map_err(|_| SignError())
|
verifier.verify(signature).map_err(|_| SignError())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -782,7 +782,7 @@ mod tests {
|
|||||||
.done();
|
.done();
|
||||||
assert!(res.is_err());
|
assert!(res.is_err());
|
||||||
|
|
||||||
let res: Result<(), ()> = Inbox::handle(&(), act.clone())
|
let res: Result<(), ()> = Inbox::handle(&(), act)
|
||||||
.with::<FailingActor, Create, MyObject>(None)
|
.with::<FailingActor, Create, MyObject>(None)
|
||||||
.with::<MyActor, Create, MyObject>(None)
|
.with::<MyActor, Create, MyObject>(None)
|
||||||
.done();
|
.done();
|
||||||
|
@ -253,7 +253,7 @@ mod tests {
|
|||||||
.unwrap();
|
.unwrap();
|
||||||
let mut verifier = openssl::sign::Verifier::new(MessageDigest::sha256(), &key).unwrap();
|
let mut verifier = openssl::sign::Verifier::new(MessageDigest::sha256(), &key).unwrap();
|
||||||
verifier.update(data.as_bytes()).unwrap();
|
verifier.update(data.as_bytes()).unwrap();
|
||||||
verifier.verify(&signature).map_err(|_| Error())
|
verifier.verify(signature).map_err(|_| Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,7 +262,7 @@ mod tests {
|
|||||||
let signer = MySigner::new();
|
let signer = MySigner::new();
|
||||||
let headers = HeaderMap::new();
|
let headers = HeaderMap::new();
|
||||||
let result = signature(&signer, &headers, ("post", "/inbox", None)).unwrap();
|
let result = signature(&signer, &headers, ("post", "/inbox", None)).unwrap();
|
||||||
let fields: Vec<&str> = result.to_str().unwrap().split(",").collect();
|
let fields: Vec<&str> = result.to_str().unwrap().split(',').collect();
|
||||||
assert_eq!(r#"headers="(request-target)""#, fields[2]);
|
assert_eq!(r#"headers="(request-target)""#, fields[2]);
|
||||||
let sign = &fields[3][11..(fields[3].len() - 1)];
|
let sign = &fields[3][11..(fields[3].len() - 1)];
|
||||||
assert!(signer.verify("post /inbox", sign.as_bytes()).is_ok());
|
assert!(signer.verify("post /inbox", sign.as_bytes()).is_ok());
|
||||||
|
Loading…
Reference in New Issue
Block a user