Skip to content

Commit

Permalink
Fix user role update in Software (#680)
Browse files Browse the repository at this point in the history
* moved from workspaceUserUpdateRequest to workspaceUpsertUserRole to update user role

* code review changes: updated the field name to WorkspaceUpsertUserRole
  • Loading branch information
neel-astro committed Aug 10, 2022
1 parent 3e56ed8 commit 49e51f1
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions houston/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,8 @@ mutation UpdateDeployment($deploymentId: Uuid!, $payload: JSON!, $executor: Exec
}`

WorkspaceUserUpdateRequest = `
mutation workspaceUpdateUserRole($workspaceUuid: Uuid!, $email: String!, $role: Role!) {
workspaceUpdateUserRole(
mutation workspaceUpsertUserRole($workspaceUuid: Uuid!, $email: String!, $role: Role!) {
workspaceUpsertUserRole(
workspaceUuid: $workspaceUuid
email: $email
role: $role
Expand Down
2 changes: 1 addition & 1 deletion houston/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ type ResponseData struct {
CancelUpdateDeploymentRuntime *Deployment `json:"cancelRuntimeUpdate,omitempty"`
UpdateWorkspace *Workspace `json:"updateWorkspace,omitempty"`
DeploymentLog []DeploymentLog `json:"logs,omitempty"`
WorkspaceUpdateUserRole string `json:"workspaceUpdateUserRole,omitempty"`
WorkspaceUpsertUserRole string `json:"workspaceUpsertUserRole,omitempty"`
WorkspaceGetUser WorkspaceUserRoleBindings `json:"workspaceUser,omitempty"`
WorkspaceGetUsers []WorkspaceUserRoleBindings `json:"workspaceUsers,omitempty"`
DeploymentConfig DeploymentConfig `json:"deploymentConfig,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion houston/workspace_users.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (h ClientImplementation) UpdateWorkspaceUserRole(workspaceID, email, role s
return "", handleAPIErr(err)
}

return r.Data.WorkspaceUpdateUserRole, nil
return r.Data.WorkspaceUpsertUserRole, nil
}

// GetUserRoleInWorkspace - get a user role in a workspace
Expand Down
4 changes: 2 additions & 2 deletions houston/workspace_users_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func TestUpdateWorkspaceUserAndRole(t *testing.T) {

mockResponse := &Response{
Data: ResponseData{
WorkspaceUpdateUserRole: DeploymentAdminRole,
WorkspaceUpsertUserRole: DeploymentAdminRole,
},
}
jsonResponse, err := json.Marshal(mockResponse)
Expand All @@ -199,7 +199,7 @@ func TestUpdateWorkspaceUserAndRole(t *testing.T) {

response, err := api.UpdateWorkspaceUserRole("workspace-id", "email", DeploymentAdminRole)
assert.NoError(t, err)
assert.Equal(t, response, mockResponse.Data.WorkspaceUpdateUserRole)
assert.Equal(t, response, mockResponse.Data.WorkspaceUpsertUserRole)
})

t.Run("error", func(t *testing.T) {
Expand Down

0 comments on commit 49e51f1

Please sign in to comment.