Admin dashboard and sessions
This commit is contained in:
@@ -20,3 +20,19 @@ async fn an_error_flash_message_is_set_on_failure() {
|
||||
let login_page_html = app.get_login_html().await;
|
||||
assert!(!login_page_html.contains("Authentication failed"));
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn login_redirects_to_admin_dashboard_after_login_success() {
|
||||
let app = TestApp::spawn().await;
|
||||
|
||||
let login_body = serde_json::json!({
|
||||
"username": &app.test_user.username,
|
||||
"password": &app.test_user.password
|
||||
});
|
||||
|
||||
let response = app.post_login(&login_body).await;
|
||||
assert_is_redirect_to(&response, "/admin/dashboard");
|
||||
|
||||
let html_page = app.get_admin_dashboard_html().await;
|
||||
assert!(html_page.contains(&format!("Welcome {}", app.test_user.username)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user