You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-11-23 11:02:35 +03:00
storage: make the Clock a trait
This commit is contained in:
@@ -143,7 +143,7 @@ impl<'c> CompatAccessTokenRepository for PgCompatAccessTokenRepository<'c> {
|
||||
async fn add(
|
||||
&mut self,
|
||||
rng: &mut (dyn RngCore + Send),
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
compat_session: &CompatSession,
|
||||
token: String,
|
||||
expires_after: Option<Duration>,
|
||||
@@ -191,7 +191,7 @@ impl<'c> CompatAccessTokenRepository for PgCompatAccessTokenRepository<'c> {
|
||||
)]
|
||||
async fn expire(
|
||||
&mut self,
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
mut compat_access_token: CompatAccessToken,
|
||||
) -> Result<CompatAccessToken, Self::Error> {
|
||||
let expires_at = clock.now();
|
||||
|
||||
@@ -27,6 +27,7 @@ mod tests {
|
||||
use chrono::Duration;
|
||||
use mas_data_model::Device;
|
||||
use mas_storage::{
|
||||
clock::MockClock,
|
||||
compat::{
|
||||
CompatAccessTokenRepository, CompatRefreshTokenRepository, CompatSessionRepository,
|
||||
},
|
||||
@@ -44,7 +45,7 @@ mod tests {
|
||||
const FIRST_TOKEN: &str = "first_access_token";
|
||||
const SECOND_TOKEN: &str = "second_access_token";
|
||||
let mut rng = ChaChaRng::seed_from_u64(42);
|
||||
let clock = Clock::mock();
|
||||
let clock = MockClock::default();
|
||||
let mut repo = PgRepository::from_pool(&pool).await.unwrap();
|
||||
|
||||
// Create a user
|
||||
@@ -101,7 +102,7 @@ mod tests {
|
||||
const FIRST_TOKEN: &str = "first_access_token";
|
||||
const SECOND_TOKEN: &str = "second_access_token";
|
||||
let mut rng = ChaChaRng::seed_from_u64(42);
|
||||
let clock = Clock::mock();
|
||||
let clock = MockClock::default();
|
||||
let mut repo = PgRepository::from_pool(&pool).await.unwrap();
|
||||
|
||||
// Create a user
|
||||
@@ -221,7 +222,7 @@ mod tests {
|
||||
const ACCESS_TOKEN: &str = "access_token";
|
||||
const REFRESH_TOKEN: &str = "refresh_token";
|
||||
let mut rng = ChaChaRng::seed_from_u64(42);
|
||||
let clock = Clock::mock();
|
||||
let clock = MockClock::default();
|
||||
let mut repo = PgRepository::from_pool(&pool).await.unwrap();
|
||||
|
||||
// Create a user
|
||||
|
||||
@@ -154,7 +154,7 @@ impl<'c> CompatRefreshTokenRepository for PgCompatRefreshTokenRepository<'c> {
|
||||
async fn add(
|
||||
&mut self,
|
||||
rng: &mut (dyn RngCore + Send),
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
compat_session: &CompatSession,
|
||||
compat_access_token: &CompatAccessToken,
|
||||
token: String,
|
||||
@@ -202,7 +202,7 @@ impl<'c> CompatRefreshTokenRepository for PgCompatRefreshTokenRepository<'c> {
|
||||
)]
|
||||
async fn consume(
|
||||
&mut self,
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
compat_refresh_token: CompatRefreshToken,
|
||||
) -> Result<CompatRefreshToken, Self::Error> {
|
||||
let consumed_at = clock.now();
|
||||
|
||||
@@ -122,7 +122,7 @@ impl<'c> CompatSessionRepository for PgCompatSessionRepository<'c> {
|
||||
async fn add(
|
||||
&mut self,
|
||||
rng: &mut (dyn RngCore + Send),
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
user: &User,
|
||||
device: Device,
|
||||
) -> Result<CompatSession, Self::Error> {
|
||||
@@ -166,7 +166,7 @@ impl<'c> CompatSessionRepository for PgCompatSessionRepository<'c> {
|
||||
)]
|
||||
async fn finish(
|
||||
&mut self,
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
compat_session: CompatSession,
|
||||
) -> Result<CompatSession, Self::Error> {
|
||||
let finished_at = clock.now();
|
||||
|
||||
@@ -177,7 +177,7 @@ impl<'c> CompatSsoLoginRepository for PgCompatSsoLoginRepository<'c> {
|
||||
async fn add(
|
||||
&mut self,
|
||||
rng: &mut (dyn RngCore + Send),
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
login_token: String,
|
||||
redirect_uri: Url,
|
||||
) -> Result<CompatSsoLogin, Self::Error> {
|
||||
@@ -223,7 +223,7 @@ impl<'c> CompatSsoLoginRepository for PgCompatSsoLoginRepository<'c> {
|
||||
)]
|
||||
async fn fulfill(
|
||||
&mut self,
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
compat_sso_login: CompatSsoLogin,
|
||||
compat_session: &CompatSession,
|
||||
) -> Result<CompatSsoLogin, Self::Error> {
|
||||
@@ -265,7 +265,7 @@ impl<'c> CompatSsoLoginRepository for PgCompatSsoLoginRepository<'c> {
|
||||
)]
|
||||
async fn exchange(
|
||||
&mut self,
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
compat_sso_login: CompatSsoLogin,
|
||||
) -> Result<CompatSsoLogin, Self::Error> {
|
||||
let exchanged_at = clock.now();
|
||||
|
||||
@@ -142,7 +142,7 @@ impl<'c> OAuth2AccessTokenRepository for PgOAuth2AccessTokenRepository<'c> {
|
||||
async fn add(
|
||||
&mut self,
|
||||
rng: &mut (dyn RngCore + Send),
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
session: &Session,
|
||||
access_token: String,
|
||||
expires_after: Duration,
|
||||
@@ -182,7 +182,7 @@ impl<'c> OAuth2AccessTokenRepository for PgOAuth2AccessTokenRepository<'c> {
|
||||
|
||||
async fn revoke(
|
||||
&mut self,
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
access_token: AccessToken,
|
||||
) -> Result<AccessToken, Self::Error> {
|
||||
let revoked_at = clock.now();
|
||||
@@ -205,7 +205,7 @@ impl<'c> OAuth2AccessTokenRepository for PgOAuth2AccessTokenRepository<'c> {
|
||||
.map_err(DatabaseError::to_invalid_operation)
|
||||
}
|
||||
|
||||
async fn cleanup_expired(&mut self, clock: &Clock) -> Result<usize, Self::Error> {
|
||||
async fn cleanup_expired(&mut self, clock: &dyn Clock) -> Result<usize, Self::Error> {
|
||||
// Cleanup token which expired more than 15 minutes ago
|
||||
let threshold = clock.now() - Duration::minutes(15);
|
||||
let res = sqlx::query!(
|
||||
|
||||
@@ -211,7 +211,7 @@ impl<'c> OAuth2AuthorizationGrantRepository for PgOAuth2AuthorizationGrantReposi
|
||||
async fn add(
|
||||
&mut self,
|
||||
rng: &mut (dyn RngCore + Send),
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
client: &Client,
|
||||
redirect_uri: Url,
|
||||
scope: Scope,
|
||||
@@ -410,7 +410,7 @@ impl<'c> OAuth2AuthorizationGrantRepository for PgOAuth2AuthorizationGrantReposi
|
||||
)]
|
||||
async fn fulfill(
|
||||
&mut self,
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
session: &Session,
|
||||
grant: AuthorizationGrant,
|
||||
) -> Result<AuthorizationGrant, Self::Error> {
|
||||
@@ -451,7 +451,7 @@ impl<'c> OAuth2AuthorizationGrantRepository for PgOAuth2AuthorizationGrantReposi
|
||||
)]
|
||||
async fn exchange(
|
||||
&mut self,
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
grant: AuthorizationGrant,
|
||||
) -> Result<AuthorizationGrant, Self::Error> {
|
||||
let exchanged_at = clock.now();
|
||||
|
||||
@@ -378,7 +378,7 @@ impl<'c> OAuth2ClientRepository for PgOAuth2ClientRepository<'c> {
|
||||
async fn add(
|
||||
&mut self,
|
||||
mut rng: &mut (dyn RngCore + Send),
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
redirect_uris: Vec<Url>,
|
||||
encrypted_client_secret: Option<String>,
|
||||
grant_types: Vec<GrantType>,
|
||||
@@ -535,7 +535,7 @@ impl<'c> OAuth2ClientRepository for PgOAuth2ClientRepository<'c> {
|
||||
async fn add_from_config(
|
||||
&mut self,
|
||||
mut rng: impl Rng + Send,
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
client_id: Ulid,
|
||||
client_auth_method: OAuthClientAuthenticationMethod,
|
||||
encrypted_client_secret: Option<String>,
|
||||
@@ -707,7 +707,7 @@ impl<'c> OAuth2ClientRepository for PgOAuth2ClientRepository<'c> {
|
||||
async fn give_consent_for_user(
|
||||
&mut self,
|
||||
rng: &mut (dyn RngCore + Send),
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
client: &Client,
|
||||
user: &User,
|
||||
scope: &Scope,
|
||||
|
||||
@@ -150,7 +150,7 @@ impl<'c> OAuth2RefreshTokenRepository for PgOAuth2RefreshTokenRepository<'c> {
|
||||
async fn add(
|
||||
&mut self,
|
||||
rng: &mut (dyn RngCore + Send),
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
session: &Session,
|
||||
access_token: &AccessToken,
|
||||
refresh_token: String,
|
||||
@@ -199,7 +199,7 @@ impl<'c> OAuth2RefreshTokenRepository for PgOAuth2RefreshTokenRepository<'c> {
|
||||
)]
|
||||
async fn consume(
|
||||
&mut self,
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
refresh_token: RefreshToken,
|
||||
) -> Result<RefreshToken, Self::Error> {
|
||||
let consumed_at = clock.now();
|
||||
|
||||
@@ -131,7 +131,7 @@ impl<'c> OAuth2SessionRepository for PgOAuth2SessionRepository<'c> {
|
||||
async fn create_from_grant(
|
||||
&mut self,
|
||||
rng: &mut (dyn RngCore + Send),
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
grant: &AuthorizationGrant,
|
||||
user_session: &BrowserSession,
|
||||
) -> Result<Session, Self::Error> {
|
||||
@@ -182,7 +182,7 @@ impl<'c> OAuth2SessionRepository for PgOAuth2SessionRepository<'c> {
|
||||
),
|
||||
err,
|
||||
)]
|
||||
async fn finish(&mut self, clock: &Clock, session: Session) -> Result<Session, Self::Error> {
|
||||
async fn finish(&mut self, clock: &dyn Clock, session: Session) -> Result<Session, Self::Error> {
|
||||
let finished_at = clock.now();
|
||||
let res = sqlx::query!(
|
||||
r#"
|
||||
|
||||
@@ -149,7 +149,7 @@ impl<'c> UpstreamOAuthLinkRepository for PgUpstreamOAuthLinkRepository<'c> {
|
||||
async fn add(
|
||||
&mut self,
|
||||
rng: &mut (dyn RngCore + Send),
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
upstream_oauth_provider: &UpstreamOAuthProvider,
|
||||
subject: String,
|
||||
) -> Result<UpstreamOAuthLink, Self::Error> {
|
||||
|
||||
@@ -25,12 +25,13 @@ pub use self::{
|
||||
mod tests {
|
||||
use chrono::Duration;
|
||||
use mas_storage::{
|
||||
clock::MockClock,
|
||||
upstream_oauth2::{
|
||||
UpstreamOAuthLinkRepository, UpstreamOAuthProviderRepository,
|
||||
UpstreamOAuthSessionRepository,
|
||||
},
|
||||
user::UserRepository,
|
||||
Clock, Pagination, Repository,
|
||||
Pagination, Repository,
|
||||
};
|
||||
use oauth2_types::scope::{Scope, OPENID};
|
||||
use rand::SeedableRng;
|
||||
@@ -41,7 +42,7 @@ mod tests {
|
||||
#[sqlx::test(migrator = "crate::MIGRATOR")]
|
||||
async fn test_repository(pool: PgPool) {
|
||||
let mut rng = rand_chacha::ChaChaRng::seed_from_u64(42);
|
||||
let clock = Clock::mock();
|
||||
let clock = MockClock::default();
|
||||
let mut repo = PgRepository::from_pool(&pool).await.unwrap();
|
||||
|
||||
// The provider list should be empty at the start
|
||||
@@ -183,7 +184,7 @@ mod tests {
|
||||
let scope = Scope::from_iter([OPENID]);
|
||||
|
||||
let mut rng = rand_chacha::ChaChaRng::seed_from_u64(42);
|
||||
let clock = Clock::mock();
|
||||
let clock = MockClock::default();
|
||||
let mut repo = PgRepository::from_pool(&pool).await.unwrap();
|
||||
|
||||
let mut ids = Vec::with_capacity(20);
|
||||
|
||||
@@ -149,7 +149,7 @@ impl<'c> UpstreamOAuthProviderRepository for PgUpstreamOAuthProviderRepository<'
|
||||
async fn add(
|
||||
&mut self,
|
||||
rng: &mut (dyn RngCore + Send),
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
issuer: String,
|
||||
scope: Scope,
|
||||
token_endpoint_auth_method: OAuthClientAuthenticationMethod,
|
||||
|
||||
@@ -156,7 +156,7 @@ impl<'c> UpstreamOAuthSessionRepository for PgUpstreamOAuthSessionRepository<'c>
|
||||
async fn add(
|
||||
&mut self,
|
||||
rng: &mut (dyn RngCore + Send),
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
upstream_oauth_provider: &UpstreamOAuthProvider,
|
||||
state_str: String,
|
||||
code_challenge_verifier: Option<String>,
|
||||
@@ -217,7 +217,7 @@ impl<'c> UpstreamOAuthSessionRepository for PgUpstreamOAuthSessionRepository<'c>
|
||||
)]
|
||||
async fn complete_with_link(
|
||||
&mut self,
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
upstream_oauth_authorization_session: UpstreamOAuthAuthorizationSession,
|
||||
upstream_oauth_link: &UpstreamOAuthLink,
|
||||
id_token: Option<String>,
|
||||
@@ -260,7 +260,7 @@ impl<'c> UpstreamOAuthSessionRepository for PgUpstreamOAuthSessionRepository<'c>
|
||||
)]
|
||||
async fn consume(
|
||||
&mut self,
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
upstream_oauth_authorization_session: UpstreamOAuthAuthorizationSession,
|
||||
) -> Result<UpstreamOAuthAuthorizationSession, Self::Error> {
|
||||
let consumed_at = clock.now();
|
||||
|
||||
@@ -68,7 +68,7 @@ struct UserEmailConfirmationCodeLookup {
|
||||
}
|
||||
|
||||
impl UserEmailConfirmationCodeLookup {
|
||||
fn into_verification(self, clock: &Clock) -> UserEmailVerification {
|
||||
fn into_verification(self, clock: &dyn Clock) -> UserEmailVerification {
|
||||
let now = clock.now();
|
||||
let state = if let Some(when) = self.consumed_at {
|
||||
UserEmailVerificationState::AlreadyUsed { when }
|
||||
@@ -301,7 +301,7 @@ impl<'c> UserEmailRepository for PgUserEmailRepository<'c> {
|
||||
async fn add(
|
||||
&mut self,
|
||||
rng: &mut (dyn RngCore + Send),
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
user: &User,
|
||||
email: String,
|
||||
) -> Result<UserEmail, Self::Error> {
|
||||
@@ -378,7 +378,7 @@ impl<'c> UserEmailRepository for PgUserEmailRepository<'c> {
|
||||
|
||||
async fn mark_as_verified(
|
||||
&mut self,
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
mut user_email: UserEmail,
|
||||
) -> Result<UserEmail, Self::Error> {
|
||||
let confirmed_at = clock.now();
|
||||
@@ -430,7 +430,7 @@ impl<'c> UserEmailRepository for PgUserEmailRepository<'c> {
|
||||
async fn add_verification_code(
|
||||
&mut self,
|
||||
rng: &mut (dyn RngCore + Send),
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
user_email: &UserEmail,
|
||||
max_age: chrono::Duration,
|
||||
code: String,
|
||||
@@ -479,7 +479,7 @@ impl<'c> UserEmailRepository for PgUserEmailRepository<'c> {
|
||||
)]
|
||||
async fn find_verification_code(
|
||||
&mut self,
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
user_email: &UserEmail,
|
||||
code: &str,
|
||||
) -> Result<Option<UserEmailVerification>, Self::Error> {
|
||||
@@ -521,7 +521,7 @@ impl<'c> UserEmailRepository for PgUserEmailRepository<'c> {
|
||||
)]
|
||||
async fn consume_verification_code(
|
||||
&mut self,
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
mut user_email_verification: UserEmailVerification,
|
||||
) -> Result<UserEmailVerification, Self::Error> {
|
||||
if !matches!(
|
||||
|
||||
@@ -148,7 +148,7 @@ impl<'c> UserRepository for PgUserRepository<'c> {
|
||||
async fn add(
|
||||
&mut self,
|
||||
rng: &mut (dyn RngCore + Send),
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
username: String,
|
||||
) -> Result<User, Self::Error> {
|
||||
let created_at = clock.now();
|
||||
|
||||
@@ -115,7 +115,7 @@ impl<'c> UserPasswordRepository for PgUserPasswordRepository<'c> {
|
||||
async fn add(
|
||||
&mut self,
|
||||
rng: &mut (dyn RngCore + Send),
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
user: &User,
|
||||
version: u16,
|
||||
hashed_password: String,
|
||||
|
||||
@@ -142,7 +142,7 @@ impl<'c> BrowserSessionRepository for PgBrowserSessionRepository<'c> {
|
||||
async fn add(
|
||||
&mut self,
|
||||
rng: &mut (dyn RngCore + Send),
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
user: &User,
|
||||
) -> Result<BrowserSession, Self::Error> {
|
||||
let created_at = clock.now();
|
||||
@@ -185,7 +185,7 @@ impl<'c> BrowserSessionRepository for PgBrowserSessionRepository<'c> {
|
||||
)]
|
||||
async fn finish(
|
||||
&mut self,
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
mut user_session: BrowserSession,
|
||||
) -> Result<BrowserSession, Self::Error> {
|
||||
let finished_at = clock.now();
|
||||
@@ -297,7 +297,7 @@ impl<'c> BrowserSessionRepository for PgBrowserSessionRepository<'c> {
|
||||
async fn authenticate_with_password(
|
||||
&mut self,
|
||||
rng: &mut (dyn RngCore + Send),
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
mut user_session: BrowserSession,
|
||||
user_password: &Password,
|
||||
) -> Result<BrowserSession, Self::Error> {
|
||||
@@ -342,7 +342,7 @@ impl<'c> BrowserSessionRepository for PgBrowserSessionRepository<'c> {
|
||||
async fn authenticate_with_upstream(
|
||||
&mut self,
|
||||
rng: &mut (dyn RngCore + Send),
|
||||
clock: &Clock,
|
||||
clock: &dyn Clock,
|
||||
mut user_session: BrowserSession,
|
||||
upstream_oauth_link: &UpstreamOAuthLink,
|
||||
) -> Result<BrowserSession, Self::Error> {
|
||||
|
||||
@@ -14,8 +14,9 @@
|
||||
|
||||
use chrono::Duration;
|
||||
use mas_storage::{
|
||||
clock::MockClock,
|
||||
user::{BrowserSessionRepository, UserEmailRepository, UserPasswordRepository, UserRepository},
|
||||
Clock, Repository,
|
||||
Repository,
|
||||
};
|
||||
use rand::SeedableRng;
|
||||
use rand_chacha::ChaChaRng;
|
||||
@@ -30,7 +31,7 @@ async fn test_user_repo(pool: PgPool) {
|
||||
|
||||
let mut repo = PgRepository::from_pool(&pool).await.unwrap();
|
||||
let mut rng = ChaChaRng::seed_from_u64(42);
|
||||
let clock = Clock::mock();
|
||||
let clock = MockClock::default();
|
||||
|
||||
// Initially, the user shouldn't exist
|
||||
assert!(!repo.user().exists(USERNAME).await.unwrap());
|
||||
@@ -78,7 +79,7 @@ async fn test_user_email_repo(pool: PgPool) {
|
||||
|
||||
let mut repo = PgRepository::from_pool(&pool).await.unwrap();
|
||||
let mut rng = ChaChaRng::seed_from_u64(42);
|
||||
let clock = Clock::mock();
|
||||
let clock = MockClock::default();
|
||||
|
||||
let user = repo
|
||||
.user()
|
||||
@@ -89,7 +90,7 @@ async fn test_user_email_repo(pool: PgPool) {
|
||||
// The user email should not exist yet
|
||||
assert!(repo
|
||||
.user_email()
|
||||
.find(&user, EMAIL)
|
||||
.find(&user, &EMAIL)
|
||||
.await
|
||||
.unwrap()
|
||||
.is_none());
|
||||
@@ -110,7 +111,7 @@ async fn test_user_email_repo(pool: PgPool) {
|
||||
|
||||
assert!(repo
|
||||
.user_email()
|
||||
.find(&user, EMAIL)
|
||||
.find(&user, &EMAIL)
|
||||
.await
|
||||
.unwrap()
|
||||
.is_some());
|
||||
@@ -180,7 +181,7 @@ async fn test_user_email_repo(pool: PgPool) {
|
||||
// Reload the user_email
|
||||
let user_email = repo
|
||||
.user_email()
|
||||
.find(&user, EMAIL)
|
||||
.find(&user, &EMAIL)
|
||||
.await
|
||||
.unwrap()
|
||||
.expect("user email was not found");
|
||||
@@ -260,7 +261,7 @@ async fn test_user_password_repo(pool: PgPool) {
|
||||
|
||||
let mut repo = PgRepository::from_pool(&pool).await.unwrap();
|
||||
let mut rng = ChaChaRng::seed_from_u64(42);
|
||||
let clock = Clock::mock();
|
||||
let clock = MockClock::default();
|
||||
|
||||
let user = repo
|
||||
.user()
|
||||
@@ -340,7 +341,7 @@ async fn test_user_session(pool: PgPool) {
|
||||
|
||||
let mut repo = PgRepository::from_pool(&pool).await.unwrap();
|
||||
let mut rng = ChaChaRng::seed_from_u64(42);
|
||||
let clock = Clock::mock();
|
||||
let clock = MockClock::default();
|
||||
|
||||
let user = repo
|
||||
.user()
|
||||
|
||||
Reference in New Issue
Block a user