Skip to content

Commit

Permalink
Updated the unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Vidya2606 committed May 17, 2024
1 parent 5d0a300 commit c161d14
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions pkg/providers/azure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,14 +359,13 @@ func TestCreateAzApp(t *testing.T) {
}
}

// Empty App name
func TestCreateAzApp_ErrorCreatingApp(t *testing.T) {
ctrl := gomock.NewController(t)
defer ctrl.Finish()

mockGraphClient := mock_providers.NewMockGraphClient(ctrl)

errToSend = errors.New("getting application object Id: mock error")

mockAppRequestBuilder := &graphapp.ApplicationsRequestBuilder{
BaseRequestBuilder: abstractions.BaseRequestBuilder{
PathParameters: map[string]string{"key": "value"},
Expand All @@ -375,8 +374,7 @@ func TestCreateAzApp_ErrorCreatingApp(t *testing.T) {
},
}

expectedErr := errors.New("creating Azure app: getting application object Id: mock error")

errToSend = errors.New("creating Azure app: mock error")
mockGraphClient.EXPECT().Applications().Return(mockAppRequestBuilder).AnyTimes()

sc := &SetUpCmd{
Expand All @@ -387,8 +385,7 @@ func TestCreateAzApp_ErrorCreatingApp(t *testing.T) {
}

err := sc.createAzApp(context.Background())

if err == nil || err.Error() != expectedErr.Error() {
t.Errorf("Expected error %v, got: %v", expectedErr, err)
if err == nil {
t.Errorf("Expected error 'creating Azure app: mock error', got nil")
}
}

0 comments on commit c161d14

Please sign in to comment.