config: fix tests using old config struct
This commit is contained in:
parent
4a1682cc96
commit
6c58fec7d3
|
@ -3,6 +3,8 @@ package config
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/spf13/viper"
|
||||||
|
|
||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -11,17 +13,17 @@ const configFile = "../config.example.json"
|
||||||
func TestLoadConfiguraiton(t *testing.T) {
|
func TestLoadConfiguraiton(t *testing.T) {
|
||||||
err := LoadConfiguration(configFile)
|
err := LoadConfiguration(configFile)
|
||||||
assert.Nil(t, err)
|
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) {
|
func TestContainsAuthKey(t *testing.T) {
|
||||||
t.Run("key exists", func(t *testing.T) {
|
t.Run("key exists", func(t *testing.T) {
|
||||||
LoadConfiguration(configFile)
|
LoadConfiguration(configFile)
|
||||||
assert.True(t, Get().ContainsAuthKey("somekey"))
|
assert.True(t, ContainsAuthKey("somekey"))
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("key doesn't exist", func(t *testing.T) {
|
t.Run("key doesn't exist", func(t *testing.T) {
|
||||||
LoadConfiguration(configFile)
|
LoadConfiguration(configFile)
|
||||||
assert.False(t, Get().ContainsAuthKey("someotherkey"))
|
assert.False(t, ContainsAuthKey("someotherkey"))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user