mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-11-14 12:15:06 +08:00
654736be29
* MSDNS: Improve reliability of zone dump * Update tests * MSDNS: Add initial NAPTR support * Update * fix tests * fix tests * Fixing integration tests for NAPTR * Handle bad JSON. Handle NAPTR TTLs
30 lines
812 B
Go
30 lines
812 B
Go
package msdns
|
|
|
|
import (
|
|
"reflect"
|
|
"testing"
|
|
|
|
"github.com/StackExchange/dnscontrol/v3/models"
|
|
)
|
|
|
|
func Test_decodeRecordDataNaptr(t *testing.T) {
|
|
type args struct {
|
|
s string
|
|
}
|
|
tests := []struct {
|
|
name string
|
|
args args
|
|
want models.RecordConfig
|
|
}{
|
|
{"01", args{"C8AFB0B30153075349502B4432540474657374165F7369702E5F7463702E6578616D706C652E6F72672E"}, models.RecordConfig{NaptrOrder: 45000, NaptrPreference: 46000, NaptrFlags: "S", NaptrService: "SIP+D2T", NaptrRegexp: "test", Name: "_sip._tcp.example.org."}},
|
|
}
|
|
for _, tt := range tests {
|
|
tt.want.SetTarget(tt.want.Name)
|
|
tt.want.Name = ""
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
if got := decodeRecordDataNaptr(tt.args.s); !reflect.DeepEqual(got, tt.want) {
|
|
t.Errorf("decodeRecordDataNaptr() = %+v, want %+v", got, tt.want)
|
|
}
|
|
})
|
|
}
|
|
}
|