29 lines
520 B
Go
29 lines
520 B
Go
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"])
|
|
}
|