53a3fbc464
use correct handler to provide server logs remove Baerer from Authorization header to compare it with known tokens fix wings-api.paw routes
30 lines
610 B
Go
30 lines
610 B
Go
package config
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/spf13/viper"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
const configFile = "../config.example.yml"
|
|
|
|
func TestLoadConfiguraiton(t *testing.T) {
|
|
err := LoadConfiguration(configFile)
|
|
assert.Nil(t, err)
|
|
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, ContainsAuthKey("somekey"))
|
|
})
|
|
|
|
t.Run("key doesn't exist", func(t *testing.T) {
|
|
LoadConfiguration(configFile)
|
|
assert.False(t, ContainsAuthKey("someotherkey"))
|
|
})
|
|
}
|