use actix_web::{web, Responder}; use askama::Template; use crate::utils::{ApplicationError, TemplateResponse}; use brass_db::models::User; #[derive(Template)] #[template(path = "user/profile_change_password.html")] struct ProfileChangePasswordTemplate {} #[actix_web::get("/users/changepassword")] pub async fn get(_user: web::ReqData) -> Result { let template = ProfileChangePasswordTemplate {}; Ok(template.to_response()?) } #[cfg(test)] mod tests { use actix_http::StatusCode; use brass_macros::db_test; use crate::utils::test_helper::{ assert_snapshot, test_get, DbTestContext, RequestConfig, ServiceResponseExt, }; #[db_test] async fn produces_template_fine(context: &DbTestContext) { let config = RequestConfig::new("/users/changepassword"); let response = test_get(&context.db_pool, context.app().await, &config).await; let (status, body) = response.into_status_and_body().await; assert_eq!(StatusCode::OK, status); assert_snapshot!(body); } }