Skip to content

Commit cfeebd7

Browse files
committed
add a test for 404
1 parent 45e3547 commit cfeebd7

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/index.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,19 @@ async fn test_access_config_forbidden() {
3030
);
3131
}
3232

33+
#[actix_web::test]
34+
async fn test_404() {
35+
for f in [
36+
"/does_not_exist.sql",
37+
"/does_not_exist.html",
38+
"/does_not_exist/",
39+
] {
40+
let resp_result = req_path(f).await;
41+
let resp = resp_result.unwrap_err().error_response();
42+
assert_eq!(resp.status(), http::StatusCode::NOT_FOUND, "{f} isnt 404");
43+
}
44+
}
45+
3346
async fn req_path(path: &str) -> Result<actix_web::dev::ServiceResponse, actix_web::Error> {
3447
init_log();
3548
let config = test_config();

0 commit comments

Comments
 (0)