github.com/teknogeek/dnscontrol/v2@v2.10.1-0.20200227202244-ae299b55ba42/providers/gandi_v5/convert_test.go (about) 1 package gandi5 2 3 import ( 4 "testing" 5 6 "github.com/StackExchange/dnscontrol/v2/models" 7 ) 8 9 func TestRecordsToNative_1(t *testing.T) { 10 var rcs = []*models.RecordConfig{{}} 11 rcs[0].SetLabelFromFQDN("foo.example.com", "example.com") 12 rcs[0].Type = "A" 13 rcs[0].SetTarget("1.2.3.4") 14 15 ns := recordsToNative(rcs, "example.com") 16 17 if len(ns) != 1 { 18 t.Errorf("len(ns) != 1; got=%v", len(ns)) 19 } 20 if len(ns[0].RrsetValues) != 1 { 21 t.Errorf("len(ns[0].RrsetValues) != 1; got=%v", ns[0].RrsetValues) 22 } 23 24 } 25 26 func TestRecordsToNative_2(t *testing.T) { 27 var rcs = []*models.RecordConfig{{}, {}} 28 rcs[0].SetLabelFromFQDN("foo.example.com", "example.com") 29 rcs[0].Type = "A" 30 rcs[0].SetTarget("1.2.3.4") 31 rcs[1].SetLabelFromFQDN("foo.example.com", "example.com") 32 rcs[1].Type = "A" 33 rcs[1].SetTarget("5.6.7.8") 34 35 ns := recordsToNative(rcs, "example.com") 36 37 if len(ns) != 1 { 38 t.Errorf("len(ns) != 1; got=%v", len(ns)) 39 } 40 if len(ns[0].RrsetValues) != 2 { 41 t.Errorf("len(ns[0].RrsetValues) != 2; got=%v", ns[0].RrsetValues) 42 } 43 44 }