* fix: secret file reading * do ToUpper for keys not only for cli args * add tests
This commit is contained in:
28
cmd/root_test.go
Normal file
28
cmd/root_test.go
Normal file
@@ -0,0 +1,28 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"path"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestReadSecrets(t *testing.T) {
|
||||
secrets := map[string]string{}
|
||||
ret := readEnvsEx(path.Join("testdata", "secrets.yml"), secrets, true)
|
||||
assert.True(t, ret)
|
||||
assert.Equal(t, `line1
|
||||
line2
|
||||
line3
|
||||
`, secrets["MYSECRET"])
|
||||
}
|
||||
|
||||
func TestReadEnv(t *testing.T) {
|
||||
secrets := map[string]string{}
|
||||
ret := readEnvs(path.Join("testdata", "secrets.yml"), secrets)
|
||||
assert.True(t, ret)
|
||||
assert.Equal(t, `line1
|
||||
line2
|
||||
line3
|
||||
`, secrets["mysecret"])
|
||||
}
|
||||
Reference in New Issue
Block a user