use crate::auth::oauth::old::OAuthServiceOld;
use openlark_core::config::Config;
#[derive(Debug, Clone)]
pub struct OAuthService {
config: Config,
}
impl OAuthService {
pub fn new(config: Config) -> Self {
Self { config }
}
pub fn config(&self) -> &Config {
&self.config
}
pub fn old(&self) -> OAuthServiceOld {
OAuthServiceOld::new(self.config.clone())
}
}
impl Default for OAuthService {
fn default() -> Self {
Self::new(Config::default())
}
}
#[cfg(test)]
#[allow(unused_imports)]
mod tests {
use super::*;
#[test]
fn test_oauth_service_creation() {
let config = Config::default();
let service = OAuthService::new(config.clone());
assert_eq!(service.config().app_id(), config.app_id());
}
#[test]
fn test_old_service() {
let config = Config::default();
let service = OAuthService::new(config);
let old_service = service.old();
let _ = format!("{old_service:?}");
}
#[test]
fn test_default() {
let service = OAuthService::default();
let _ = format!("{service:?}");
}
}