From 4bd4d06aebe1a1a6736b7212672a87dd18383bfc Mon Sep 17 00:00:00 2001 From: FranciscaOrtegaG Date: Tue, 14 Nov 2023 22:19:31 -0300 Subject: [PATCH] fixed tcp client query test --- src/client.rs | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/client.rs b/src/client.rs index 945c4248..3d00e03b 100644 --- a/src/client.rs +++ b/src/client.rs @@ -228,21 +228,21 @@ mod client_test { domain_name.set_name(String::from("test.test2.com.")); let qtype = "A"; let qclass= "IN"; - let response = tcp_client.query(domain_name, qtype, qclass); + let response = tcp_client.query(domain_name, qtype, qclass).unwrap(); println!("Response: {:?}", response); - // let expected_ip: [u8; 4] = [93, 184, 216, 34]; - // let answers = response.get_answer(); - // for answer in answers { - // let a_rdata = answer.get_rdata(); - // match a_rdata { - // Rdata::SomeARdata(val) => { - // assert_eq!(val.get_address(), IpAddr::from(expected_ip)) - // }, - // _ => {} - // } - // } + let expected_ip: [u8; 4] = [93, 184, 216, 34]; + let answers = response.get_answer(); + for answer in answers { + let a_rdata = answer.get_rdata(); + match a_rdata { + Rdata::SomeARdata(val) => { + assert_eq!(val.get_address(), IpAddr::from(expected_ip)) + }, + _ => {} + } + } } // Constructor test