wings/config/config_test.go

28 lines
592 B
Go
Raw Normal View History

2017-06-26 19:04:11 +00:00
package config
import (
"testing"
"github.com/stretchr/testify/assert"
)
2017-07-06 18:49:36 +00:00
const configFile = "../config.example.json"
2017-06-26 19:04:11 +00:00
func TestLoadConfiguraiton(t *testing.T) {
2017-07-06 18:49:36 +00:00
err := LoadConfiguration(configFile)
2017-06-26 19:04:11 +00:00
assert.Nil(t, err)
assert.Equal(t, Get().Web.ListenHost, "0.0.0.0")
}
2017-07-06 18:49:36 +00:00
func TestContainsAuthKey(t *testing.T) {
t.Run("key exists", func(t *testing.T) {
LoadConfiguration(configFile)
assert.True(t, Get().ContainsAuthKey("somekey"))
})
t.Run("key doesn't exist", func(t *testing.T) {
LoadConfiguration(configFile)
assert.False(t, Get().ContainsAuthKey("someotherkey"))
})
}