create tests for model/rower.rs, Closes #32
This commit is contained in:
@ -453,7 +453,7 @@ mod test {
|
||||
assert_eq!(flash_cookie.value(), "7:successDanke für's helfen!");
|
||||
|
||||
let req = client.get("/cox/join/1");
|
||||
let response = req.dispatch().await;
|
||||
let _ = req.dispatch().await;
|
||||
|
||||
let req = client.get("/cox/remove/1");
|
||||
let response = req.dispatch().await;
|
||||
|
@ -129,6 +129,7 @@ async fn create_logbook(db: &SqlitePool, data: Form<LogToAdd>) -> Flash<Redirect
|
||||
Err(LogbookCreateError::BoatLocked) => Flash::error(Redirect::to("/log"), format!("Boot gesperrt")),
|
||||
Err(LogbookCreateError::BoatNotFound) => Flash::error(Redirect::to("/log"), format!("Boot gibt's ned")),
|
||||
Err(LogbookCreateError::TooManyRowers(expected, actual)) => Flash::error(Redirect::to("/log"), format!("Zu viele Ruderer (Boot fasst maximal {expected}, es wurden jedoch {actual} Ruderer ausgewählt)")),
|
||||
Err(LogbookCreateError::RowerCreateError(rower, e)) => Flash::error(Redirect::to("/log"), format!("Fehler bei Ruderer {rower}: {e}")),
|
||||
|
||||
}
|
||||
}
|
||||
@ -159,10 +160,10 @@ async fn home_logbook(
|
||||
) -> Flash<Redirect> {
|
||||
let logbook: Option<Logbook> = Logbook::find_by_id(db, logbook_id).await;
|
||||
let Some(logbook) = logbook else {
|
||||
return Flash::error(
|
||||
Redirect::to("/admin/log"),
|
||||
format!("Log with ID {} does not exist!", logbook_id),
|
||||
)
|
||||
return Flash::error(
|
||||
Redirect::to("/admin/log"),
|
||||
format!("Log with ID {} does not exist!", logbook_id),
|
||||
);
|
||||
};
|
||||
|
||||
match logbook.home(db, user, data.into_inner()).await {
|
||||
|
Reference in New Issue
Block a user