diff --git a/pkg/client/vault_test.go b/pkg/client/vault_test.go index 3f90f2f..c959978 100644 --- a/pkg/client/vault_test.go +++ b/pkg/client/vault_test.go @@ -1,34 +1,24 @@ package client import ( - "os" + vault "github.com/hashicorp/vault/api" "testing" - vault "github.com/hashicorp/vault/api" "github.com/stretchr/testify/assert" ) func TestGetVaultClient(t *testing.T) { - // With sufficient configuration - os.Setenv("VAULT_ADDR", "http://localhost:8200") - os.Setenv("VAULT_TOKEN", "s.xxxxxx") + // TODO: login tests with mocked server config := &AuthConfig{ - AuthMethod: "token", + AuthMethod: "", AuthPath: "", AuthNoStore: true, AuthMethodArgs: map[string]string{}, } c, err := getVaultClient(config) - assert.Nil(t, err) - assert.IsType(t, &vault.Client{}, c) - assert.NotNil(t, c) - - // Without VAULT_ADDR defined - os.Unsetenv("VAULT_ADDR") - c, err = getVaultClient(config) - assert.Error(t, err, "initializing vault client: VAULT_ADDR env is not defined") + assert.Error(t, err, "initializing vault client") assert.IsType(t, &vault.Client{}, c) assert.Nil(t, c) }