1
0
mirror of https://github.com/StackExchange/dnscontrol.git synced 2024-05-11 05:55:12 +00:00

Expect SOA mailbox in hostmaster@example.org format instead of hostmaster.example.org (#2037)

Co-authored-by: Yannik Sembritzki <yannik@sembritzki.org>
Co-authored-by: Tom Limoncelli <tlimoncelli@stackoverflow.com>
This commit is contained in:
Yannik Sembritzki
2023-02-07 19:55:41 +05:30
committed by GitHub
parent 9eacd42b63
commit dc02d5b74f
5 changed files with 64 additions and 10 deletions

View File

@@ -0,0 +1,28 @@
package soautil
import (
"reflect"
"testing"
)
func Test_RFC5322MailToBind(t *testing.T) {
type args struct {
rfc5322Mail string
}
tests := []struct {
name string
rfc5322Mail string
bindMail string
}{
{"0", "hostmaster@example.com", "hostmaster.example.com"},
{"1", "admin.dns@example.com", "admin\\.dns.example.com"},
{"2", "hostmaster@sub.example.com", "hostmaster.sub.example.com"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := RFC5322MailToBind(tt.rfc5322Mail); !reflect.DeepEqual(got, tt.bindMail) {
t.Errorf("RFC5322MailToBind(%v) = %v, want %v", tt.rfc5322Mail, got, tt.bindMail)
}
})
}
}