From 4aa7f01da39ab55b4f6346e7565d8bb29566de39 Mon Sep 17 00:00:00 2001 From: Vika Date: Sun, 5 Dec 2021 23:00:01 +0300 Subject: Code cleanup and small bugfixing in templates --- src/lib.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/lib.rs') diff --git a/src/lib.rs b/src/lib.rs index 108a42f..817bda7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,8 +4,8 @@ use tide::{Request, Response}; pub mod database; mod frontend; mod indieauth; -mod micropub; mod metrics; +mod micropub; use crate::indieauth::IndieAuthMiddleware; use crate::micropub::CORSMiddleware; @@ -110,21 +110,25 @@ pub async fn get_app_with_file( } #[cfg(test)] -pub async fn get_app_with_test_file(token_endpoint: surf::Url) -> ( +pub async fn get_app_with_test_file( + token_endpoint: surf::Url, +) -> ( tempdir::TempDir, database::FileStorage, - App + App, ) { use surf::Url; let tempdir = tempdir::TempDir::new("file").expect("Failed to create tempdir"); - let backend = database::FileStorage::new(tempdir.path().to_path_buf()).await.unwrap(); + let backend = database::FileStorage::new(tempdir.path().to_path_buf()) + .await + .unwrap(); let app = tide::with_state(ApplicationState { token_endpoint, media_endpoint: None, authorization_endpoint: Url::parse("https://indieauth.com/auth").unwrap(), storage: backend.clone(), internal_token: None, - http_client: surf::Client::new() + http_client: surf::Client::new(), }); (tempdir, backend, equip_app(app)) } -- cgit 1.4.1