mirror of
https://github.com/StackExchange/dnscontrol.git
synced 2025-01-13 02:50:27 +08:00
1b83561b7f
Fixes https://github.com/StackExchange/dnscontrol/issues/1060 Fixes https://github.com/StackExchange/dnscontrol/issues/1059
44 lines
1,019 B
Go
44 lines
1,019 B
Go
package gandi_v5
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/StackExchange/dnscontrol/v3/models"
|
|
)
|
|
|
|
func TestRecordsToNative_1(t *testing.T) {
|
|
var rcs = []*models.RecordConfig{{}}
|
|
rcs[0].SetLabelFromFQDN("foo.example.com", "example.com")
|
|
rcs[0].Type = "A"
|
|
rcs[0].SetTarget("1.2.3.4")
|
|
|
|
ns := recordsToNative(rcs, "example.com")
|
|
|
|
if len(ns) != 1 {
|
|
t.Errorf("len(ns) != 1; got=%v", len(ns))
|
|
}
|
|
if len(ns[0].RrsetValues) != 1 {
|
|
t.Errorf("len(ns[0].RrsetValues) != 1; got=%v", ns[0].RrsetValues)
|
|
}
|
|
|
|
}
|
|
|
|
func TestRecordsToNative_2(t *testing.T) {
|
|
var rcs = []*models.RecordConfig{{}, {}}
|
|
rcs[0].SetLabelFromFQDN("foo.example.com", "example.com")
|
|
rcs[0].Type = "A"
|
|
rcs[0].SetTarget("1.2.3.4")
|
|
rcs[1].SetLabelFromFQDN("foo.example.com", "example.com")
|
|
rcs[1].Type = "A"
|
|
rcs[1].SetTarget("5.6.7.8")
|
|
|
|
ns := recordsToNative(rcs, "example.com")
|
|
|
|
if len(ns) != 1 {
|
|
t.Errorf("len(ns) != 1; got=%v", len(ns))
|
|
}
|
|
if len(ns[0].RrsetValues) != 2 {
|
|
t.Errorf("len(ns[0].RrsetValues) != 2; got=%v", ns[0].RrsetValues)
|
|
}
|
|
|
|
}
|