@@ -138,25 +138,12 @@ Describe 'Organizations' {
138138 { Update-GitHubOrganization - Name $orgName - Location ' New Location' } | Should - Throw
139139 }
140140
141+ It ' Remove-GitHubOrganization - Removes an organization using enterprise installation' - Skip:($OwnerType -ne ' enterprise' ) {
142+ { Remove-GitHubOrganization - Name $orgName - Confirm:$false } | Should - Throw
143+ }
144+
141145 It ' Install-GitHubApp - Installs a GitHub App to an organization' - Skip:($OwnerType -ne ' enterprise' ) {
142- # The enterprise organization was just created and may not have propagated to the
143- # enterprise apps endpoint yet. Retry briefly to absorb propagation delay before
144- # failing — GitHub returns 404 (rather than 403) when the resource is not yet visible
145- # to the token, which is indistinguishable from a missing-permission failure on the
146- # first call. See issue #596.
147- $installation = $null
148- $maxAttempts = 5
149- $delaySeconds = 3
150- for ($attempt = 1 ; $attempt -le $maxAttempts ; $attempt ++ ) {
151- try {
152- $installation = Install-GitHubApp - Enterprise $owner - Organization $orgName - ClientID $installationContext.ClientID - RepositorySelection ' all'
153- break
154- } catch {
155- if ($attempt -eq $maxAttempts ) { throw }
156- Write-Host " Install-GitHubApp attempt $attempt failed ($ ( $_.Exception.Message ) ); retrying in $delaySeconds seconds..."
157- Start-Sleep - Seconds $delaySeconds
158- }
159- }
146+ $installation = Install-GitHubApp - Enterprise $owner - Organization $orgName - ClientID $installationContext.ClientID - RepositorySelection ' all'
160147 LogGroup ' Installed App' {
161148 Write-Host ($installation | Select-Object * | Out-String )
162149 }
@@ -177,15 +164,6 @@ Describe 'Organizations' {
177164 Update-GitHubOrganization - Name $orgName - Location ' New Location' - Context $orgContext
178165 }
179166
180- # GitHub's DELETE /orgs/{org} endpoint requires the app to have the org-level
181- # `administration: write` permission. The enterprise IAT is enterprise-scoped and does not
182- # carry org-level permissions, so this call is expected to fail regardless of which
183- # enterprise permissions the app holds. An org-level IAT (obtained after Install-GitHubApp)
184- # is required. See issue #596.
185- It ' Remove-GitHubOrganization - Removes an organization using enterprise installation' - Skip:($OwnerType -ne ' enterprise' ) {
186- { Remove-GitHubOrganization - Name $orgName - Confirm:$false } | Should - Throw
187- }
188-
189167 It ' Remove-GitHubOrganization - Removes an organization using organization installation' - Skip:($OwnerType -ne ' enterprise' ) {
190168 $orgContext = Connect-GitHubApp - Organization $orgName - Context $context - PassThru - Silent
191169 Remove-GitHubOrganization - Name $orgName - Confirm:$false - Context $orgContext
0 commit comments