File tree Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -48,9 +48,30 @@ async fn query_all_type() {
48
48
}
49
49
}
50
50
51
- // TODO: 6.2.3 Query Qtype = MX
51
+ /// 6.2.3 Query Qtype = MX
52
+ #[ tokio:: test]
52
53
async fn query_mx_type ( ) {
53
- unimplemented ! ( ) ;
54
+ let response = query_response ( "example.com" , "MX" ) . await ;
55
+
56
+ if let Ok ( rrs) = response {
57
+ assert_eq ! ( rrs. len( ) , 1 ) ;
58
+
59
+ if let Rdata :: MX ( mxdata) = rrs[ 0 ] . get_rdata ( ) {
60
+ assert_eq ! (
61
+ mxdata. get_exchange( ) ,
62
+ DomainName :: new_from_str( "" ) ) ;
63
+
64
+ assert_eq ! (
65
+ mxdata. get_preference( ) ,
66
+ 0
67
+ )
68
+ } else {
69
+ panic ! ( "Record is not MX type" ) ;
70
+ }
71
+
72
+ } else {
73
+ panic ! ( "No response received" )
74
+ }
54
75
}
55
76
56
77
@@ -66,15 +87,15 @@ async fn query_ns_type() {
66
87
ns1. get_nsdname( ) ,
67
88
DomainName :: new_from_str( "a.iana-servers.net" ) )
68
89
} else {
69
- panic ! ( "First record is not type NS" ) ;
90
+ panic ! ( "First record is not NS" ) ;
70
91
}
71
92
72
93
if let Rdata :: NS ( ns) = rrs[ 1 ] . get_rdata ( ) {
73
94
assert_eq ! (
74
95
ns. get_nsdname( ) ,
75
96
DomainName :: new_from_str( "b.iana-servers.net" ) )
76
97
} else {
77
- panic ! ( "Second record is not type NS" ) ;
98
+ panic ! ( "Second record is not NS" ) ;
78
99
}
79
100
80
101
} else {
You can’t perform that action at this time.
0 commit comments