You've already forked authentication-service
mirror of
https://github.com/matrix-org/matrix-authentication-service.git
synced 2025-07-29 22:01:14 +03:00
Add test helpers for handlers and use them
Also expands the test coverage of the revoke handler.
This commit is contained in:
@ -18,7 +18,7 @@
|
||||
//! [`SystemClock`] which uses the system time, and a [`MockClock`], which can
|
||||
//! be used and freely manipulated in tests.
|
||||
|
||||
use std::sync::atomic::AtomicI64;
|
||||
use std::sync::{atomic::AtomicI64, Arc};
|
||||
|
||||
use chrono::{DateTime, TimeZone, Utc};
|
||||
|
||||
@ -28,6 +28,12 @@ pub trait Clock: Sync {
|
||||
fn now(&self) -> DateTime<Utc>;
|
||||
}
|
||||
|
||||
impl<C: Clock + Send + ?Sized> Clock for Arc<C> {
|
||||
fn now(&self) -> DateTime<Utc> {
|
||||
(**self).now()
|
||||
}
|
||||
}
|
||||
|
||||
impl<C: Clock + ?Sized> Clock for Box<C> {
|
||||
fn now(&self) -> DateTime<Utc> {
|
||||
(**self).now()
|
||||
|
Reference in New Issue
Block a user