summaryrefslogtreecommitdiffstats
path: root/rust/tests/test_auth.rs
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2019-01-08 23:18:32 -0800
committerBryan Newbold <bnewbold@robocracy.org>2019-01-08 23:20:53 -0800
commitba7d6a842cb4d61357b588fb2d3ec552c654ae64 (patch)
tree41eb8c465cd1ad0a9f70e18f49905adf7e5c3b40 /rust/tests/test_auth.rs
parenteb6fb8e5fe1efb3fbb927d13075cf5a1b33aa83e (diff)
downloadfatcat-ba7d6a842cb4d61357b588fb2d3ec552c654ae64.tar.gz
fatcat-ba7d6a842cb4d61357b588fb2d3ec552c654ae64.zip
huge refactor of rust modules/files
Taking advantage of new Rust 2018 crate/module path changes, and re-organizing things. Somewhat optimistic this could help with partial rebuild speed also.
Diffstat (limited to 'rust/tests/test_auth.rs')
-rw-r--r--rust/tests/test_auth.rs17
1 files changed, 7 insertions, 10 deletions
diff --git a/rust/tests/test_auth.rs b/rust/tests/test_auth.rs
index 82d9f981..d93051f2 100644
--- a/rust/tests/test_auth.rs
+++ b/rust/tests/test_auth.rs
@@ -1,16 +1,13 @@
-extern crate chrono;
-extern crate fatcat;
-extern crate uuid;
-
-use fatcat::api_helpers::*;
-use fatcat::auth::*;
+use fatcat::auth::AuthConfectionary;
+use fatcat::identifiers::FatCatId;
+use fatcat::{auth, server};
use std::str::FromStr;
#[test]
fn test_macaroons() {
// Test everything we can without connecting to database
- let c = fatcat::auth::AuthConfectionary::new_dummy();
+ let c = AuthConfectionary::new_dummy();
let editor_id = FatCatId::from_str("q3nouwy3nnbsvo3h5klxsx4a7y").unwrap();
// create token w/o expiration
@@ -25,9 +22,9 @@ fn test_macaroons() {
fn test_auth_db() {
// Test things that require database
- let server = fatcat::test_server().unwrap();
+ let server = server::create_test_server().unwrap();
let conn = server.db_pool.get().expect("db_pool error");
- let c = fatcat::auth::AuthConfectionary::new_dummy();
+ let c = AuthConfectionary::new_dummy();
let editor_id = FatCatId::from_str("aaaaaaaaaaaabkvkaaaaaaaaae").unwrap();
// create token
@@ -38,7 +35,7 @@ fn test_auth_db() {
assert_eq!(editor_row.id, editor_id.to_uuid());
// revoke token
- revoke_tokens(&conn, editor_id).unwrap();
+ auth::revoke_tokens(&conn, editor_id).unwrap();
// verification should fail
// XXX: one-second slop breaks this