diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2025-08-24 03:32:21 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2025-08-24 04:51:24 -0400 |
| commit | c1d688146956a23366c8e076328bb53351b999b5 (patch) | |
| tree | 3ec84ed38448b2179a76241e69a5a2994bf7a2c9 /src/user/handlers/logout/test.rs | |
| parent | 53944ef14af4d37c08464cb1bb9f3a8f09277194 (diff) | |
Define a canonical "empty" response.
This is a bit tidier and easier to assert on than returning a bare HTTP status code, but is otherwise interchangeable with it.
Diffstat (limited to 'src/user/handlers/logout/test.rs')
| -rw-r--r-- | src/user/handlers/logout/test.rs | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/user/handlers/logout/test.rs b/src/user/handlers/logout/test.rs index 8dc4636..7151ddf 100644 --- a/src/user/handlers/logout/test.rs +++ b/src/user/handlers/logout/test.rs @@ -1,9 +1,6 @@ -use axum::{ - extract::{Json, State}, - http::StatusCode, -}; +use axum::extract::{Json, State}; -use crate::{test::fixtures, token::app}; +use crate::{empty::Empty, test::fixtures, token::app}; #[tokio::test] async fn successful() { @@ -17,7 +14,7 @@ async fn successful() { // Call the endpoint - let (response_identity, response_status) = super::handler( + let (response_identity, Empty) = super::handler( State(app.clone()), fixtures::now(), identity.clone(), @@ -29,7 +26,6 @@ async fn successful() { // Verify the return value's basic structure assert!(response_identity.secret().is_none()); - assert_eq!(StatusCode::NO_CONTENT, response_status); // Verify the semantics let error = app @@ -49,14 +45,13 @@ async fn no_identity() { // Call the endpoint let identity = fixtures::cookie::not_logged_in(); - let (identity, status) = super::handler(State(app), fixtures::now(), identity, Json::default()) + let (identity, Empty) = super::handler(State(app), fixtures::now(), identity, Json::default()) .await .expect("logged out with no token succeeds"); // Verify the return value's basic structure assert!(identity.secret().is_none()); - assert_eq!(StatusCode::NO_CONTENT, status); } #[tokio::test] |
