This repository has been archived on 2020-09-27. You can view files and clone it, but cannot push or open issues or pull requests.
2017-10-01 23:30:48 +02:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestReadConfig(t *testing.T) {
|
|
|
|
assert := assert.New(t)
|
|
|
|
|
|
|
|
config, err := ReadConfigFile("../../config_example.conf")
|
|
|
|
assert.NoError(err)
|
|
|
|
assert.NotNil(config)
|
|
|
|
|
2017-10-10 00:54:14 +02:00
|
|
|
assert.Equal("/tmp/ssl", config.TLSDir)
|
2017-10-01 23:30:48 +02:00
|
|
|
|
|
|
|
config, err = ReadConfigFile("../config_example.co")
|
|
|
|
assert.Nil(config)
|
|
|
|
assert.Contains(err.Error(), "no such file or directory")
|
|
|
|
|
|
|
|
config, err = ReadConfigFile("testdata/config_panic.conf")
|
|
|
|
assert.Nil(config)
|
|
|
|
assert.Contains(err.Error(), "keys cannot contain")
|
|
|
|
}
|