2021-06-20 15:39:54 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestGetConfigLocationWithDefault(t *testing.T) {
|
2021-06-29 08:07:28 +02:00
|
|
|
assert.Equal(t, "config", getConfigLocation())
|
2021-06-20 15:39:54 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
func TestGetConfigLocationWithEnvironmentOverride(t *testing.T) {
|
|
|
|
os.Setenv("PRBOT_CONFIG_PATH", "/tmp/")
|
|
|
|
|
2021-06-29 08:07:28 +02:00
|
|
|
assert.Equal(t, "/tmp/", getConfigLocation())
|
2021-06-20 15:39:54 +02:00
|
|
|
|
|
|
|
t.Cleanup(func() {
|
|
|
|
os.Unsetenv("PRBOT_CONFIG_PATH")
|
|
|
|
})
|
|
|
|
}
|