Skip to content

chore: assign user to multiple orgs in coderdtest user create #13867

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

Merged
merged 2 commits into from
Jul 10, 2024

Conversation

Emyrk
Copy link
Member

@Emyrk Emyrk commented Jul 10, 2024

CreateAnotherUser can now assign users to multiple orgs. As I write multi-org tests, this is super useful to reduce LoC.

third := coderdtest.CreateOrganization(t, client, coderdtest.CreateOrganizationOptions{})

// Assign the user to 3 orgs in this 1 statement
_, user := coderdtest.CreateAnotherUser(t, client, owner.OrganizationID, rbac.ScopedRoleOrgMember(second.ID), rbac.ScopedRoleOrgMember(third.ID))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the result of this change. This line creates a new user and assigns them to 3 organizations. Much easier than doing this manually.

@Emyrk Emyrk changed the title chore: coderdtest assign user to multiple orgs on create chore: assign user to multiple orgs in coderdtest user create Jul 10, 2024
@Emyrk Emyrk requested a review from f0ssel July 10, 2024 17:27
Log: api.Logger,
Request: r,
Action: database.AuditActionCreate,
OrganizationID: organization.ID,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed these org ID's were missing in the audit logs

Copy link
Contributor

@f0ssel f0ssel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great addition to the test suite

@Emyrk Emyrk merged commit a588ec5 into main Jul 10, 2024
34 checks passed
@Emyrk Emyrk deleted the stevenmasley/organization_member branch July 10, 2024 17:38
@github-actions github-actions bot locked and limited conversation to collaborators Jul 10, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants