28 lines
651 B
Rust
28 lines
651 B
Rust
use std::{net::Ipv4Addr, str::FromStr};
|
|
|
|
use dns_comunications::DnsManager;
|
|
|
|
fn get_manager() -> DnsManager {
|
|
dns_comunications::DnsManager::new(
|
|
dns_config::ServerZonesConnection::get_config(&"config.toml".to_string()).unwrap(),
|
|
)
|
|
.unwrap()
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn test_creating_zone() {
|
|
let res = get_manager()
|
|
.add_domain(
|
|
&"testzone".to_string(),
|
|
Ipv4Addr::from_str("1.1.1.1").unwrap(),
|
|
)
|
|
.await;
|
|
assert!(res.is_ok());
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn test_deleting_zone() {
|
|
let res = get_manager().del_domain(&"testzone".to_string()).await;
|
|
assert!(res.is_ok());
|
|
}
|