-
Notifications
You must be signed in to change notification settings - Fork 956
test: add tests for updating workspace acl #19240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
ctx := testutil.Context(t, testutil.WaitMedium) | ||
err := client.UpdateWorkspaceACL(ctx, ws.ID, codersdk.UpdateWorkspaceACL{ | ||
UserRoles: map[string]codersdk.WorkspaceRole{ | ||
friend.ID.String(): codersdk.WorkspaceRoleAdmin, | ||
}, | ||
}) | ||
require.NoError(t, err) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should you test the friend can access the workspace with some friendClient
call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanna go a step farther and do that as part of some e2e tests in a coming pr
err := client.UpdateWorkspaceACL(ctx, ws.ID, codersdk.UpdateWorkspaceACL{ | ||
UserRoles: map[string]codersdk.WorkspaceRole{ | ||
friend.ID.String(): codersdk.WorkspaceRoleAdmin, | ||
}, | ||
GroupRoles: map[string]codersdk.WorkspaceRole{ | ||
group.ID.String(): codersdk.WorkspaceRoleAdmin, | ||
}, | ||
}) | ||
require.NoError(t, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as user comment. Maybe try to access the workspace via the new acl. And not use the UserRoles
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here. I'll also do an e2e test for making sure multiple users in a group can access a shared workspace.
Adds missing tests for the
/acl [patch]
route