summaryrefslogtreecommitdiffstats
path: root/rust/tests/test_auth.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2018-12-31 14:57:29 -0800
committerBryan Newbold <bnewbold@robocracy.org>2018-12-31 14:57:29 -0800
commite16ba3d02564121ae5f27e0784be86137f3b9386 (patch)
treee1e19c2e1b678d041b64501c35a1ace6e8da900b /rust/tests/test_auth.rs
parent230032ec1a13dd3830bcffed6112c2fddabc4b6e (diff)
downloadfatcat-e16ba3d02564121ae5f27e0784be86137f3b9386.tar.gz
fatcat-e16ba3d02564121ae5f27e0784be86137f3b9386.zip
rustfmt; implement role-based auth checks
Diffstat (limited to 'rust/tests/test_auth.rs')
-rw-r--r--rust/tests/test_auth.rs12
1 files changed, 5 insertions, 7 deletions
diff --git a/rust/tests/test_auth.rs b/rust/tests/test_auth.rs
index 5b04d595..8d20dafd 100644
--- a/rust/tests/test_auth.rs
+++ b/rust/tests/test_auth.rs
@@ -1,17 +1,16 @@
-
+extern crate chrono;
extern crate fatcat;
extern crate uuid;
-extern crate chrono;
-use std::str::FromStr;
use chrono::prelude::*;
-use fatcat::auth::*;
use fatcat::api_helpers::*;
+use fatcat::auth::*;
+use std::str::FromStr;
#[test]
fn test_macaroons() {
// Test everything we can without connecting to database
-
+
let c = fatcat::auth::AuthConfectionary::new_dummy();
let editor_id = FatCatId::from_str("q3nouwy3nnbsvo3h5klxsx4a7y").unwrap();
@@ -23,7 +22,6 @@ fn test_macaroons() {
c.create_token(editor_id, Some(tomorrow)).unwrap();
}
-
#[test]
fn test_auth_db() {
// Test things that require database
@@ -39,7 +37,7 @@ fn test_auth_db() {
// verify token
let editor_row = c.parse_macaroon_token(&conn, &token).unwrap();
assert_eq!(editor_row.id, editor_id.to_uuid());
-
+
// revoke token
revoke_tokens(&conn, editor_id).unwrap();