bottest/tests/unit/security/security.rs

43 lines
No EOL
1 KiB
Rust

#![allow(unused_imports)]
#![allow(unused_variables)]
#![allow(dead_code)]
#[test]
fn test_convert_to_https() {
assert_eq!(
convert_to_https("http://localhost:8080"),
"https://localhost:8080"
);
assert_eq!(
convert_to_https("https://localhost:8080"),
"https://localhost:8080"
);
assert_eq!(convert_to_https("localhost:8080"), "https://localhost:8080");
}
#[test]
fn test_get_secure_port() {
assert_eq!(get_secure_port("api", 8080), 8443);
assert_eq!(get_secure_port("llm", 8081), 8444);
assert_eq!(get_secure_port("redis", 6379), 6380);
assert_eq!(get_secure_port("unknown", 3000), 3443);
}
#[test]
fn test_security_config_default() {
let config = SecurityConfig::default();
assert!(config.tls_enabled);
assert!(config.mtls_enabled);
assert!(config.auto_generate_certs);
assert_eq!(config.renewal_threshold_days, 30);
}