config: fix tests using old config struct

This commit is contained in:
Jakob Schrettenbrunner 2017-09-01 00:05:36 +02:00
parent 4a1682cc96
commit 6c58fec7d3

View File

@ -3,6 +3,8 @@ package config
import (
"testing"
"github.com/spf13/viper"
"github.com/stretchr/testify/assert"
)
@ -11,17 +13,17 @@ const configFile = "../config.example.json"
func TestLoadConfiguraiton(t *testing.T) {
err := LoadConfiguration(configFile)
assert.Nil(t, err)
assert.Equal(t, "0.0.0.0", Get().Web.ListenHost)
assert.Equal(t, "0.0.0.0", viper.GetString(APIHost))
}
func TestContainsAuthKey(t *testing.T) {
t.Run("key exists", func(t *testing.T) {
LoadConfiguration(configFile)
assert.True(t, Get().ContainsAuthKey("somekey"))
assert.True(t, ContainsAuthKey("somekey"))
})
t.Run("key doesn't exist", func(t *testing.T) {
LoadConfiguration(configFile)
assert.False(t, Get().ContainsAuthKey("someotherkey"))
assert.False(t, ContainsAuthKey("someotherkey"))
})
}