32 lines
719 B
Rust
32 lines
719 B
Rust
use std::sync::Arc;
|
|
|
|
use mockall::predicate::*;
|
|
use mockall::*;
|
|
|
|
use super::forgejo::Forgejo;
|
|
use crate::auth::application::port::out::forge::oauth_auth_req_uri::OAuthAuthReqUri;
|
|
|
|
#[automock]
|
|
pub trait ForgeAdapterFactoryInterface: Send + Sync {
|
|
fn get_oauth_auth_req_uri_adapter(&self) -> Arc<dyn OAuthAuthReqUri>;
|
|
}
|
|
|
|
#[derive(Clone)]
|
|
pub struct ForgeAdapterFactory {
|
|
forgejo: Arc<Forgejo>,
|
|
}
|
|
|
|
impl ForgeAdapterFactoryInterface for ForgeAdapterFactory {
|
|
fn get_oauth_auth_req_uri_adapter(&self) -> Arc<dyn OAuthAuthReqUri> {
|
|
self.forgejo.clone()
|
|
}
|
|
}
|
|
|
|
impl ForgeAdapterFactory {
|
|
pub fn new(forgejo: Forgejo) -> Self {
|
|
Self {
|
|
forgejo: Arc::new(forgejo),
|
|
}
|
|
}
|
|
}
|