tstor/config/config_test.go

42 lines
694 B
Go
Raw Normal View History

2021-04-04 17:24:58 +00:00
package config
import (
"io/ioutil"
"os"
"testing"
2021-11-23 12:05:49 +00:00
"github.com/goccy/go-yaml"
2021-04-04 17:24:58 +00:00
"github.com/stretchr/testify/require"
)
func TestTemplateConfig(t *testing.T) {
t.Parallel()
require := require.New(t)
f, err := os.Open("../templates/config_template.yaml")
require.NoError(err)
b, err := ioutil.ReadAll(f)
require.NoError(err)
conf := &Root{}
err = yaml.Unmarshal(b, conf)
require.NoError(err)
require.Equal(DefaultConfig(), conf)
}
2021-11-23 12:05:49 +00:00
func TestDefaults(t *testing.T) {
t.Parallel()
require := require.New(t)
r := &Root{}
dr := AddDefaults(r)
require.NotNil(dr)
require.NotNil(dr.Fuse)
require.NotNil(dr.HTTPGlobal)
require.NotNil(dr.Log)
require.NotNil(dr.Torrent)
}