Add tests for plume webserver (#513)
* begin setup front-end test environment with selenium * run migrations before tests * use https for tests
This commit is contained in:
+9
-13
@@ -59,6 +59,8 @@ mod mail;
|
||||
#[macro_use]
|
||||
mod template_utils;
|
||||
mod routes;
|
||||
#[cfg(feature = "test")]
|
||||
mod test_routes;
|
||||
|
||||
include!(concat!(env!("OUT_DIR"), "/templates.rs"));
|
||||
|
||||
@@ -122,6 +124,7 @@ Then try to restart Plume
|
||||
|
||||
let search_unlocker = searcher.clone();
|
||||
ctrlc::set_handler(move || {
|
||||
search_unlocker.commit();
|
||||
search_unlocker.drop_writer();
|
||||
exit(0);
|
||||
})
|
||||
@@ -133,7 +136,7 @@ Then try to restart Plume
|
||||
println!("Please refer to the documentation to see how to configure it.");
|
||||
}
|
||||
|
||||
rocket::custom(CONFIG.rocket.clone().unwrap())
|
||||
let rocket = rocket::custom(CONFIG.rocket.clone().unwrap())
|
||||
.mount(
|
||||
"/",
|
||||
routes![
|
||||
@@ -258,16 +261,6 @@ Then try to restart Plume
|
||||
"/@/<name>/inbox".to_owned(),
|
||||
rocket::http::Method::Post,
|
||||
),
|
||||
(
|
||||
"/login".to_owned(),
|
||||
"/login".to_owned(),
|
||||
rocket::http::Method::Post,
|
||||
),
|
||||
(
|
||||
"/users/new".to_owned(),
|
||||
"/users/new".to_owned(),
|
||||
rocket::http::Method::Post,
|
||||
),
|
||||
(
|
||||
"/api/<path..>".to_owned(),
|
||||
"/api/<path..>".to_owned(),
|
||||
@@ -276,6 +269,9 @@ Then try to restart Plume
|
||||
])
|
||||
.finalize()
|
||||
.expect("main: csrf fairing creation error"),
|
||||
)
|
||||
.launch();
|
||||
);
|
||||
|
||||
#[cfg(feature = "test")]
|
||||
let rocket = rocket.mount("/test", routes![test_routes::health,]);
|
||||
rocket.launch();
|
||||
}
|
||||
|
||||
+1
-4
@@ -43,10 +43,7 @@ pub fn create(
|
||||
#[post("/~/<blog>/<slug>/like", rank = 2)]
|
||||
pub fn create_auth(blog: String, slug: String, i18n: I18n) -> Flash<Redirect> {
|
||||
utils::requires_login(
|
||||
&i18n!(
|
||||
i18n.catalog,
|
||||
"To like a post, you need to be logged in"
|
||||
),
|
||||
&i18n!(i18n.catalog, "To like a post, you need to be logged in"),
|
||||
uri!(create: blog = blog, slug = slug),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -43,10 +43,7 @@ pub fn create(
|
||||
#[post("/~/<blog>/<slug>/reshare", rank = 1)]
|
||||
pub fn create_auth(blog: String, slug: String, i18n: I18n) -> Flash<Redirect> {
|
||||
utils::requires_login(
|
||||
&i18n!(
|
||||
i18n.catalog,
|
||||
"To reshare a post, you need to be logged in"
|
||||
),
|
||||
&i18n!(i18n.catalog, "To reshare a post, you need to be logged in"),
|
||||
uri!(create: blog = blog, slug = slug),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
#[get("/health")]
|
||||
pub fn health() {}
|
||||
Reference in New Issue
Block a user