Skip to content
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

Allow organization invitation to add users to teams #886

Merged
merged 3 commits into from
Apr 18, 2024

Conversation

JarrettSpiker
Copy link
Contributor

Description

The Terraform Cloud API allows users to be added to teams at the same time as they are added to the organization. In the UI, we actually require that you add a user to at least one team when inviting them to an org.

This allows go-tfe organization membership creation to optionally include teams which the user should be added to as well.

Testing plan

  1. Test that org invitation still works without the new team parameter
  2. Test that the user can be added to one team at membership creation
  3. Test that the user can be added to multiple teams at membership creation

External links

Output from tests


go test -timeout 30s -run ^TestOrganizationMembershipsCreate$ github.com/hashicorp/go-tfe

=== RUN   TestOrganizationMembershipsCreate
=== RUN   TestOrganizationMembershipsCreate/with_valid_options
--- PASS: TestOrganizationMembershipsCreate/with_valid_options (1.00s)
=== RUN   TestOrganizationMembershipsCreate/when_options_is_missing_email
--- PASS: TestOrganizationMembershipsCreate/when_options_is_missing_email (0.00s)
=== RUN   TestOrganizationMembershipsCreate/with_an_invalid_organization
--- PASS: TestOrganizationMembershipsCreate/with_an_invalid_organization (0.00s)
=== RUN   TestOrganizationMembershipsCreate/when_an_error_is_returned_from_the_api
--- PASS: TestOrganizationMembershipsCreate/when_an_error_is_returned_from_the_api (0.15s)
=== RUN   TestOrganizationMembershipsCreate/with_initial_teams
--- PASS: TestOrganizationMembershipsCreate/with_initial_teams (1.88s)
--- PASS: TestOrganizationMembershipsCreate (4.24s)
PASS
ok      github.com/hashicorp/go-tfe     4.449s

@JarrettSpiker JarrettSpiker requested a review from a team as a code owner April 16, 2024 13:26
@JarrettSpiker JarrettSpiker force-pushed the jspiker/inviteWithTeams branch from 52896da to 9baf330 Compare April 16, 2024 13:29
Copy link
Collaborator

@brandonc brandonc left a comment

Choose a reason for hiding this comment

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

Yeah!

@JarrettSpiker JarrettSpiker force-pushed the jspiker/inviteWithTeams branch from 9baf330 to f285cee Compare April 17, 2024 15:49
@JarrettSpiker JarrettSpiker merged commit 55960d9 into main Apr 18, 2024
7 checks passed
@JarrettSpiker JarrettSpiker deleted the jspiker/inviteWithTeams branch April 18, 2024 14:27
Copy link

Reminder to the contributor that merged this PR: if your changes have added important functionality or fixed a relevant bug, open a follow-up PR to update CHANGELOG.md with a note on your changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants