Skip to content

Commit

Permalink
feat: integrate service test assignment delete
Browse files Browse the repository at this point in the history
  • Loading branch information
1riatsila1 committed Oct 24, 2024
1 parent 9acc55a commit e1c71a6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ func (r *serviceTestGroupAssignmentResource) Delete(ctx context.Context, req res
return
}

// Delete existing serviceTestGroupAssignment using the plan_id
r.client.ConfigurationAPI.
DeleteServiceTestGroupAssignmentUxiV1alpha1ServiceTestGroupAssignmentsIdDelete(ctx, state.ID.ValueString()).
Execute()
}

func (r *serviceTestGroupAssignmentResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ func TestServiceTestGroupAssignmentResource(t *testing.T) {

util.MockDeleteGroup("group_uid", 1)
util.MockDeleteGroup("group_uid_2", 1)
util.MockDeleteServiceTestGroupAssignment("service_test_group_assignment", 1)
util.MockDeleteServiceTestGroupAssignment("service_test_group_assignment_2", 1)
},
Config: provider.ProviderConfig + `
removed {
Expand All @@ -194,7 +196,6 @@ func TestServiceTestGroupAssignmentResource(t *testing.T) {
}
}`,
},
// Delete testing automatically occurs in TestCase
},
})

Expand Down
8 changes: 8 additions & 0 deletions pkg/config-api-provider/test/util/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,14 @@ func MockPostServiceTestGroupAssignment(uid string, response map[string]interfac
JSON(response)
}

func MockDeleteServiceTestGroupAssignment(uid string, times int) {
gock.New("https://test.api.capenetworks.com").
Delete("/uxi/v1alpha1/service-test-group-assignments/"+uid).
MatchHeader("Authorization", "mock_token").
Times(times).
Reply(204)
}

var RateLimitingHeaders = map[string]string{
"X-RateLimit-Limit": "100",
"X-RateLimit-Remaining": "0",
Expand Down

0 comments on commit e1c71a6

Please sign in to comment.