simplFT/server/config/config_test.go

38 lines
846 B
Go
Raw Normal View History

package config
import (
"testing"
"github.com/spf13/viper"
)
func TestLoadConfigFromFile(t *testing.T) {
// SetDefaultConfiguration must be called BEFORE LoadConfigFromFile.
2018-10-23 06:12:48 +00:00
InitializeConfiguration("docker-config", "./")
2017-11-24 20:37:09 +00:00
Address := viper.GetString("address")
if Address == "" {
t.Error("TestLoadConfigFromFile: Can't get Address!")
}
2017-11-26 21:03:15 +00:00
Port := viper.GetInt("port")
if Port == 0 {
t.Error("TestLoadConfigFromFile: Can't get Port!")
}
2017-11-24 20:37:09 +00:00
ConfigPath := viper.GetString("configPath")
if ConfigPath == "" {
t.Error("TestLoadConfigFromFile: Can't get ConfigPath!")
}
2017-11-24 20:37:09 +00:00
DirDepth := viper.GetInt("maxDirDepth")
if DirDepth == 0 {
t.Error("TestLoadConfigFromFile: Can't get DirDepth!")
}
2017-11-24 20:37:09 +00:00
BasePath := viper.GetString("absoluteServePath")
if BasePath == "" {
t.Error("TestLoadConfigFromFile: Can't get AbsoluteServePath!")
}
}