go-ddns-client/module/config/config_test.go

79 lines
1.4 KiB
Go

package config
import (
"os"
"path"
"reflect"
"testing"
)
func TestLoadConfig(t *testing.T) {
wd, err := os.Getwd()
if err != nil {
t.Fatal(err)
}
p := path.Join(wd, "../..", "config.default.yml")
err = LoadConfig(p)
if err != nil {
t.Fatal(err)
}
}
func TestGetConfig(t *testing.T) {
conf := GetConfig()
if conf == nil {
t.Fail()
}
}
func TestDomainData_GetV6Data(t *testing.T) {
type fields struct {
Name string
Records []RecordData
}
tests := []struct {
name string
fields fields
want DomainData
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
p := DomainData{
Name: tt.fields.Name,
Records: tt.fields.Records,
}
if got := p.GetV6Data(); !reflect.DeepEqual(got, tt.want) {
t.Errorf("DomainData.GetV6Data() = %v, want %v", got, tt.want)
}
})
}
}
func TestDomainData_GetV4Data(t *testing.T) {
type fields struct {
Name string
Records []RecordData
}
tests := []struct {
name string
fields fields
want DomainData
}{
// TODO: Add test cases.
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
p := DomainData{
Name: tt.fields.Name,
Records: tt.fields.Records,
}
if got := p.GetV4Data(); !reflect.DeepEqual(got, tt.want) {
t.Errorf("DomainData.GetV4Data() = %v, want %v", got, tt.want)
}
})
}
}