pub mod v1;
pub struct AuthenService {
pub v1: v1::V1,
}
impl AuthenService {
pub fn new(config: crate::core::config::Config) -> Self {
Self {
v1: v1::V1::new(config.clone()),
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::core::config::Config;
use std::time::Duration;
#[test]
fn test_authentication_service_creation() {
let config = Config::default();
let service = AuthenService::new(config);
let _ = &service.v1;
let _ = &service.v1.user_info;
}
#[test]
fn test_authentication_service_with_custom_config() {
let config = Config::builder()
.app_id("authentication_test_app")
.app_secret("authentication_test_secret")
.req_timeout(Duration::from_secs(380))
.build();
let service = AuthenService::new(config);
let _ = &service.v1.user_info;
}
#[test]
fn test_authentication_service_config_independence() {
let config1 = Config::builder().app_id("authentication_app_1").build();
let config2 = Config::builder().app_id("authentication_app_2").build();
let service1 = AuthenService::new(config1);
let service2 = AuthenService::new(config2);
let _ = &service1.v1.user_info;
let _ = &service2.v1.user_info;
}
#[test]
fn test_authentication_service_sub_services_accessible() {
let config = Config::default();
let service = AuthenService::new(config);
let _ = &service.v1.user_info;
}
#[test]
fn test_authentication_service_config_cloning() {
let config = Config::builder()
.app_id("clone_test_app")
.app_secret("clone_test_secret")
.build();
let service = AuthenService::new(config.clone());
let _ = &service.v1.user_info;
}
#[test]
fn test_authentication_service_timeout_propagation() {
let config = Config::builder()
.req_timeout(Duration::from_secs(390))
.build();
let service = AuthenService::new(config);
let _ = &service.v1.user_info;
}
#[test]
fn test_authentication_service_multiple_instances() {
let config = Config::default();
let service1 = AuthenService::new(config.clone());
let service2 = AuthenService::new(config.clone());
let _ = &service1.v1.user_info;
let _ = &service2.v1.user_info;
}
#[test]
fn test_authentication_service_config_consistency() {
let config = Config::builder()
.app_id("consistency_test")
.app_secret("consistency_secret")
.req_timeout(Duration::from_secs(400))
.build();
let service = AuthenService::new(config);
let _ = &service.v1.user_info;
}
}