Skip to content

Commit

Permalink
feat: Updated unit test
Browse files Browse the repository at this point in the history
Signed-off-by: Kyle Morton <[email protected]>
  • Loading branch information
Kyle Morton committed Sep 1, 2022
1 parent 6927774 commit b8c65c9
Showing 1 changed file with 1 addition and 11 deletions.
12 changes: 1 addition & 11 deletions internal/pkg/vault/secrets_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,6 @@ func TestHttpSecretStoreManager_GetKeys(t *testing.T) {
name string
path string
expectedValues []string
expectError bool
expectedErrorType error
expectedDoCallNum int
caller pkg.Caller
Expand All @@ -912,7 +911,6 @@ func TestHttpSecretStoreManager_GetKeys(t *testing.T) {
name: "Get Key",
path: testPath,
expectedValues: []string{"one", "two", "three/"},
expectError: false,
expectedErrorType: nil,
expectedDoCallNum: 1,
caller: &InMemoryMockCaller{
Expand All @@ -923,7 +921,6 @@ func TestHttpSecretStoreManager_GetKeys(t *testing.T) {
name: "No keys error",
path: testPath2,
expectedValues: []string{},
expectError: false,
expectedErrorType: nil,
expectedDoCallNum: 1,
caller: &InMemoryMockCaller{
Expand All @@ -934,7 +931,6 @@ func TestHttpSecretStoreManager_GetKeys(t *testing.T) {
name: "Subpath",
path: testPath3,
expectedValues: nil,
expectError: false,
expectedErrorType: nil,
expectedDoCallNum: 1,
caller: &InMemoryMockCaller{
Expand All @@ -945,7 +941,6 @@ func TestHttpSecretStoreManager_GetKeys(t *testing.T) {
name: "Get non-existent Key",
path: "/one",
expectedValues: nil,
expectError: true,
expectedErrorType: pkg.NewErrPathNotFound("Does not exist"),
expectedDoCallNum: 1,
caller: &ErrorMockCaller{
Expand All @@ -958,7 +953,6 @@ func TestHttpSecretStoreManager_GetKeys(t *testing.T) {
name: "Get all Keys",
path: testPath4,
expectedValues: []string{"four/"},
expectError: false,
expectedErrorType: nil,
expectedDoCallNum: 1,
caller: &InMemoryMockCaller{
Expand All @@ -969,7 +963,6 @@ func TestHttpSecretStoreManager_GetKeys(t *testing.T) {
name: "Handle HTTP no path error",
path: testPath,
expectedValues: nil,
expectError: true,
expectedErrorType: TestConnErrorPathNotFound,
expectedDoCallNum: 1,
caller: &ErrorMockCaller{
Expand All @@ -981,7 +974,6 @@ func TestHttpSecretStoreManager_GetKeys(t *testing.T) {
name: "Handle non-200 HTTP response",
path: testPath,
expectedValues: nil,
expectError: true,
expectedErrorType: TestConnError,
expectedDoCallNum: 1,
caller: &ErrorMockCaller{
Expand All @@ -993,7 +985,6 @@ func TestHttpSecretStoreManager_GetKeys(t *testing.T) {
name: "Get Key with unknown path",
path: "/nonexistentpath",
expectedValues: nil,
expectError: true,
expectedErrorType: TestConnErrorPathNotFound,
expectedDoCallNum: 1,
caller: &InMemoryMockCaller{
Expand All @@ -1004,7 +995,6 @@ func TestHttpSecretStoreManager_GetKeys(t *testing.T) {
name: "URL Error",
path: "bad path for URL",
expectedValues: nil,
expectError: true,
expectedErrorType: errors.New(""),
caller: &InMemoryMockCaller{
DataList: testData[testPath2],
Expand All @@ -1026,7 +1016,7 @@ func TestHttpSecretStoreManager_GetKeys(t *testing.T) {
}

actual, err := client.GetKeys(test.path)
if test.expectError {
if test.expectedErrorType != nil {
require.Error(t, err)

eet := reflect.TypeOf(test.expectedErrorType)
Expand Down

0 comments on commit b8c65c9

Please sign in to comment.