gitea-sonarqube-bot/cmd/gitea-sonarqube-bot/main_test.go
justusbunsi 5c6229be8f
Allow custom config path via environment variable
Signed-off-by: Steven Kriegler <61625851+justusbunsi@users.noreply.github.com>
2021-06-20 15:39:54 +02:00

23 lines
404 B
Go

package main
import (
"os"
"testing"
"github.com/stretchr/testify/assert"
)
func TestGetConfigLocationWithDefault(t *testing.T) {
assert.Equal(t, "config", GetConfigLocation())
}
func TestGetConfigLocationWithEnvironmentOverride(t *testing.T) {
os.Setenv("PRBOT_CONFIG_PATH", "/tmp/")
assert.Equal(t, "/tmp/", GetConfigLocation())
t.Cleanup(func() {
os.Unsetenv("PRBOT_CONFIG_PATH")
})
}