From dc7074bbf39aff895ba52abd5e7b7e9bb643cf27 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Tue, 28 Oct 2025 01:41:13 -0400 Subject: Convert the last stray tests to be generic over components deriveable from an App. There are a few places in the test fixtures that still call `App` methods directly, as they call `app.users()` (which, as per previous commits, has no `FromRef` impl). --- src/test/verify/login.rs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'src/test/verify/login.rs') diff --git a/src/test/verify/login.rs b/src/test/verify/login.rs index ae2e91e..aad01bc 100644 --- a/src/test/verify/login.rs +++ b/src/test/verify/login.rs @@ -1,23 +1,30 @@ +use axum::extract::FromRef; + use crate::{ - app::App, - login::app::LoginError, + login::app::{LoginError, Logins}, name::Name, password::Password, test::{fixtures, verify}, + token::app::Tokens, }; -pub async fn valid_login(app: &App, name: &Name, password: &Password) { - let secret = app - .logins() +pub async fn valid_login(app: &App, name: &Name, password: &Password) +where + Logins: FromRef, + Tokens: FromRef, +{ + let secret = Logins::from_ref(app) .with_password(name, password, &fixtures::now()) .await .expect("login credentials expected to be valid"); verify::token::valid_for_name(&app, &secret, &name).await; } -pub async fn invalid_login(app: &App, name: &Name, password: &Password) { - let error = app - .logins() +pub async fn invalid_login(app: &App, name: &Name, password: &Password) +where + Logins: FromRef, +{ + let error = Logins::from_ref(app) .with_password(name, password, &fixtures::now()) .await .expect_err("login credentials expected not to be valid"); -- cgit v1.2.3