File tree Expand file tree Collapse file tree 4 files changed +26
-26
lines changed
Expand file tree Collapse file tree 4 files changed +26
-26
lines changed Original file line number Diff line number Diff line change @@ -43,27 +43,6 @@ async fn test_404() {
4343 }
4444}
4545
46- #[ actix_web:: test]
47- async fn test_404_fallback ( ) {
48- for f in [
49- "/tests/does_not_exist.sql" ,
50- "/tests/does_not_exist.html" ,
51- "/tests/does_not_exist/" ,
52- ] {
53- let resp_result = req_path ( f) . await ;
54- let resp = resp_result. unwrap ( ) ;
55- assert_eq ! ( resp. status( ) , http:: StatusCode :: OK , "{f} isnt 200" ) ;
56-
57- let body = test:: read_body ( resp) . await ;
58- assert ! ( body. starts_with( b"<!DOCTYPE html>" ) ) ;
59- let body = String :: from_utf8 ( body. to_vec ( ) ) . unwrap ( ) ;
60- assert ! ( body. contains( "But the " ) ) ;
61- assert ! ( body. contains( "404.sql" ) ) ;
62- assert ! ( body. contains( "file saved the day!" ) ) ;
63- assert ! ( !body. contains( "error" ) ) ;
64- }
65- }
66-
6746#[ actix_web:: test]
6847async fn test_static_files ( ) {
6948 let resp = req_path ( "/tests/it_works.txt" ) . await . unwrap ( ) ;
Original file line number Diff line number Diff line change 1- use actix_web:: {
2- http:: StatusCode ,
3- test,
4- } ;
1+ use actix_web:: { http:: StatusCode , test} ;
52use sqlpage:: { webserver, AppState } ;
63use sqlx:: Executor as _;
74
File renamed without changes.
Original file line number Diff line number Diff line change 1- use actix_web:: { http:: StatusCode , test} ;
1+ use actix_web:: {
2+ http:: { self , StatusCode } ,
3+ test,
4+ } ;
25
36use crate :: common:: req_path;
47
@@ -17,3 +20,24 @@ async fn test_privileged_paths_are_not_accessible() {
1720 . to_lowercase( )
1821 . contains( "forbidden" ) , ) ;
1922}
23+
24+ #[ actix_web:: test]
25+ async fn test_404_fallback ( ) {
26+ for f in [
27+ "/tests/errors/does_not_exist.sql" ,
28+ "/tests/errors/does_not_exist.html" ,
29+ "/tests/errors/does_not_exist/" ,
30+ ] {
31+ let resp_result = req_path ( f) . await ;
32+ let resp = resp_result. unwrap ( ) ;
33+ assert_eq ! ( resp. status( ) , http:: StatusCode :: OK , "{f} isnt 200" ) ;
34+
35+ let body = test:: read_body ( resp) . await ;
36+ assert ! ( body. starts_with( b"<!DOCTYPE html>" ) ) ;
37+ let body = String :: from_utf8 ( body. to_vec ( ) ) . unwrap ( ) ;
38+ assert ! ( body. contains( "But the " ) ) ;
39+ assert ! ( body. contains( "404.sql" ) ) ;
40+ assert ! ( body. contains( "file saved the day!" ) ) ;
41+ assert ! ( !body. contains( "error" ) ) ;
42+ }
43+ }
You can’t perform that action at this time.
0 commit comments