mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2024-05-11 05:55:12 +00:00
Bugfix: redirect: should be redirect= (#507)
This commit is contained in:
@ -42,19 +42,46 @@ func TestParseWithDoubleSpaces(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestParseRedirectNotLast(t *testing.T) {
|
||||
// Make sure redirect:foo fails if it isn't the last item.
|
||||
// Make sure redirect=foo fails if it isn't the last item.
|
||||
dnsres, err := NewCache("testdata-dns1.json")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_, err = Parse(strings.Join([]string{"v=spf1",
|
||||
"redirect=servers.mcsv.net",
|
||||
"~all"}, " "), dnsres)
|
||||
if err == nil {
|
||||
t.Fatal("should fail")
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseRedirectColon(t *testing.T) {
|
||||
// Make sure redirect:foo fails.
|
||||
dnsres, err := NewCache("testdata-dns1.json")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
_, err = Parse(strings.Join([]string{"v=spf1",
|
||||
"redirect:servers.mcsv.net",
|
||||
"~all"}, " "), dnsres)
|
||||
}, " "), dnsres)
|
||||
if err == nil {
|
||||
t.Fatal("should fail")
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseRedirectOnly(t *testing.T) {
|
||||
dnsres, err := NewCache("testdata-dns1.json")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
rec, err := Parse(strings.Join([]string{"v=spf1",
|
||||
"redirect=servers.mcsv.net"}, " "), dnsres)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Log(rec.Print())
|
||||
}
|
||||
|
||||
func TestParseRedirectLast(t *testing.T) {
|
||||
dnsres, err := NewCache("testdata-dns1.json")
|
||||
if err != nil {
|
||||
@ -62,7 +89,7 @@ func TestParseRedirectLast(t *testing.T) {
|
||||
}
|
||||
rec, err := Parse(strings.Join([]string{"v=spf1",
|
||||
"ip4:198.252.206.0/24",
|
||||
"redirect:servers.mcsv.net"}, " "), dnsres)
|
||||
"redirect=servers.mcsv.net"}, " "), dnsres)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user