Skip to content

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

Merged
Emyrk merged 2 commits into
mainfrom
stevenmasley/organization_member
Jul 10, 2024
Merged

chore: assign user to multiple orgs in coderdtest user create#13867
Emyrk merged 2 commits into
mainfrom
stevenmasley/organization_member

Conversation

@Emyrk
Copy link
Copy Markdown
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
Copy Markdown
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
Comment thread coderd/members.go
Log: api.Logger,
Request: r,
Action: database.AuditActionCreate,
OrganizationID: organization.ID,
Copy link
Copy Markdown
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
Copy Markdown
Member

@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
@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