diff options
| author | Owen Jacobson <owen@grimoire.ca> | 2025-08-24 16:37:41 -0400 |
|---|---|---|
| committer | Owen Jacobson <owen@grimoire.ca> | 2025-08-26 00:57:57 -0400 |
| commit | c52e24f17ed615b2e2dd55a285eb272014a2ccbf (patch) | |
| tree | 757fbef4a4e8236f831d859370e4774e86138bd5 /src/user/handlers/logout | |
| parent | 6c65e97e49d1d56380aa7d71abb0394b08ff60ca (diff) | |
Factor out common authentication test verification steps into helpers.
These checks tended to be wordy, and were prone to being done subtly differently in different locations for no good reason. Centralizing them cleans this up and makes the tests easier to follow, at the expense of making it somewhat harder to follow what the test is specifically checking.
Diffstat (limited to 'src/user/handlers/logout')
| -rw-r--r-- | src/user/handlers/logout/test.rs | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/user/handlers/logout/test.rs b/src/user/handlers/logout/test.rs index 7151ddf..8ad4853 100644 --- a/src/user/handlers/logout/test.rs +++ b/src/user/handlers/logout/test.rs @@ -1,6 +1,10 @@ use axum::extract::{Json, State}; -use crate::{empty::Empty, test::fixtures, token::app}; +use crate::{ + empty::Empty, + test::{fixtures, verify}, + token::app, +}; #[tokio::test] async fn successful() { @@ -24,16 +28,10 @@ async fn successful() { .expect("logged out with a valid token"); // Verify the return value's basic structure - assert!(response_identity.secret().is_none()); // Verify the semantics - let error = app - .tokens() - .validate(&secret, &now) - .await - .expect_err("secret is invalid"); - assert!(matches!(error, app::ValidateError::InvalidToken)); + verify::token::invalid(&app, &secret).await; } #[tokio::test] |
