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-03-25 16:09:17 +01:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestReadConfig(t *testing.T) {
|
|
|
|
assert := assert.New(t)
|
|
|
|
|
|
|
|
config := ReadConfigFile("../config_example.conf")
|
|
|
|
assert.NotNil(config)
|
|
|
|
|
2017-03-30 15:32:22 +02:00
|
|
|
assert.Equal(":8080", config.WebserverBind)
|
2017-03-26 19:33:47 +02:00
|
|
|
|
|
|
|
assert.Panics(func() {
|
|
|
|
ReadConfigFile("../config_example.co")
|
|
|
|
}, "wrong file")
|
|
|
|
|
|
|
|
assert.Panics(func() {
|
|
|
|
ReadConfigFile("testdata/config_panic.conf")
|
|
|
|
}, "wrong toml")
|
2017-03-25 16:09:17 +01:00
|
|
|
}
|