feat: Add downgrade_to option to github_membership resource - #3608
Open
galargh wants to merge 1 commit into
Open
feat: Add downgrade_to option to github_membership resource#3608galargh wants to merge 1 commit into
galargh wants to merge 1 commit into
Conversation
|
👋 Hi, and thank you for this contribution! This repo is maintained by GitHub and community members on a best-effort basis. We'll get to this as soon as we can. You can help us prioritize by joining the discussion on open issues and PRs, sharing details on the changes you need, and reviewing other contributions. 🤖 This is an automated message. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #3607
Before the change?
downgrade_on_destroyparameterAfter the change?
github_membershipgets a new optionaldowngrade_toparametermember, which preserves the previous behaviour in a backwards-compatible manneroutside_collaboratorPull request checklist
Schema migrations have been created if needed (example)(n/a: the proposal is backwards-compatible)Does this introduce a breaking change?
Please see our docs on breaking changes to help!
Testing
Warning
TestAccGithubMembership/downgrades_organization_membership_to_outside_collaboratorrequiresGH_TEST_EXTERNAL_USER1_TOKENto be a Classic PAT withwrite:orgpermissions. This is because only active organisation members can be turned into outside collaborators, so the invite it issues must be accepted. Unfortunately, the fine-grained tokens do not cover organisation invitation acceptance. The newly added behaviour is also covered by unit tests, so we could remove this acceptance test case if we don't want to use a classic token here.✅ Acceptance Tests
TestAccGithubMembership/downgrades_organization_membership_to_outside_collaboratorgithub_membershipresource✅ Unit Tests
Test_resourceGithubMembershipDelete/removes membership- asserts that destroy withdowngrade_on_destroy = falseis successful (uses mocks);Test_resourceGithubMembershipDelete/member default; asserts that destroy withdowngrade_on_destroy = trueis successful (uses mocks);Test_resourceGithubMembershipDelete/outside collaborator; asserts that destroy withdowngrade_on_destroy = trueanddowngrade_to = outside_collaboratoris successful (uses mocks);Test_resourceGithubMembershipDelete/outside collaborator pending invitation- asserts that destroy withdowngrade_on_destroy = trueanddowngrade_to = outside_collaboratorwhen the org invitation has not been accepted is NOT successful (uses mocks);Test_resourceGithubMembershipDelete/membership not found- asserts that destroy withdowngrade_on_destroy = trueanddowngrade_to = outside_collaboratorexits cleanly when the user is not an organisation member (uses mocks);Test_resourceGithubMembershipDowngradeToValidation- verifies validdowngrade_tovalues:memberoutside_collaborator