diff options
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/lib.rs b/src/lib.rs index 398c3b2..6a62dcc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -5,8 +5,8 @@ mod frontend; mod indieauth; mod micropub; -use crate::micropub::CORSMiddleware; use crate::indieauth::IndieAuthMiddleware; +use crate::micropub::CORSMiddleware; #[derive(Clone)] pub struct ApplicationState<StorageBackend> @@ -64,7 +64,7 @@ pub async fn get_app_with_redis( authorization_endpoint: surf::Url, redis_uri: String, media_endpoint: Option<String>, - internal_token: Option<String> + internal_token: Option<String>, ) -> App<database::RedisStorage> { let app = tide::with_state(ApplicationState { token_endpoint, @@ -169,11 +169,14 @@ mod tests { .with_body(r#"{"me": "https://aaronparecki.com/", "client_id": "https://quill.p3k.io/", "scope": "create update delete media"}"#) .create(); - let mut response = app.post("/micropub") + let mut response = app + .post("/micropub") .header("Authorization", "Bearer awoo") .header("Content-Type", "application/json") .body(json!({ "action": "delete", "url": uid })) - .send().await.unwrap(); + .send() + .await + .unwrap(); println!("{}", response.body_string().await.unwrap()); assert_eq!(response.status(), 403); } @@ -215,7 +218,11 @@ mod tests { // Should be posted successfully, but... assert!(response.status() == 201 || response.status() == 202); // ...won't be available on a foreign URL - assert!(db.get_post("https://aaronparecki.com/posts/more-fake-news").await.unwrap().is_none()); + assert!(db + .get_post("https://aaronparecki.com/posts/more-fake-news") + .await + .unwrap() + .is_none()); let response = post_json(&app, json!({ "type": ["h-entry"], |