Add stricter assertions to whoami test

This commit is contained in:
William Brown 2019-09-11 12:21:15 +10:00
parent 4ba9508a31
commit 3c774dcf6c

View file

@ -120,10 +120,12 @@ fn test_server_whoami_anonymous() {
assert!(res.is_ok()); assert!(res.is_ok());
// Now do a whoami. // Now do a whoami.
let post_res = rsclient.whoami().unwrap(); let (_e, uat) = match rsclient.whoami().unwrap() {
assert!(post_res.is_some()); Some((e, uat)) => (e, uat),
// TODO: Now unwrap and ensure anony None => panic!(),
println!("{:?}", post_res); };
debug!("{}", uat);
assert!(uat.name == "anonymous");
}); });
} }
@ -139,10 +141,12 @@ fn test_server_whoami_admin_simple_password() {
assert!(res.is_ok()); assert!(res.is_ok());
// Now do a whoami. // Now do a whoami.
let post_res = rsclient.whoami().unwrap(); let (_e, uat) = match rsclient.whoami().unwrap() {
assert!(post_res.is_some()); Some((e, uat)) => (e, uat),
// TODO: Now unwrap and ensure anony None => panic!(),
debug!("{:?}", post_res); };
debug!("{}", uat);
assert!(uat.name == "admin");
}); });
} }