-
Notifications
You must be signed in to change notification settings - Fork 189
Add ability to rename a repository: Rename-GitHubRepository #145
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
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
109b977
add cmdlet Rename-GitHubRepository, update module manifest; for #144
mtboren 1dd4998
add test, update contrib
mtboren f818224
Apply suggestions from code review -- update examples, remove comments
mtboren b00db0c
add Elements ParameterSet to Rename-GitHubRepository, add test for th…
mtboren 290bcb5
add missing param descriptions, extend an example, fix display messag…
mtboren 7b0c767
Apply suggestions from code review
mtboren File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. | ||
|
|
||
| <# | ||
| .Synopsis | ||
| Tests for GitHubRepositories.ps1 module | ||
| .Description | ||
| Many cmdlets are indirectly tested in the course of other tests (New-GitHubRepository, Remove-GitHubRepository), and may not have explicit tests here | ||
| #> | ||
|
|
||
| # This is common test code setup logic for all Pester test files | ||
| $moduleRootPath = Split-Path -Path $PSScriptRoot -Parent | ||
| . (Join-Path -Path $moduleRootPath -ChildPath 'Tests\Common.ps1') | ||
|
|
||
| try | ||
| { | ||
| Describe 'Modifying repositories' { | ||
|
|
||
| Context -Name 'For renaming a repository' -Fixture { | ||
| BeforeEach -Scriptblock { | ||
| $repo = New-GitHubRepository -RepositoryName ([Guid]::NewGuid().Guid) -AutoInit | ||
| $suffixToAddToRepo = "_renamed" | ||
| $newRepoName = "$($repo.Name)$suffixToAddToRepo" | ||
| Write-Verbose "New repo name shall be: '$newRepoName'" | ||
| } | ||
| It "Should have the expected new repository name - by URI" { | ||
| $renamedRepo = $repo | Rename-GitHubRepository -NewName $newRepoName -Confirm:$false | ||
| $renamedRepo.Name | Should be $newRepoName | ||
| } | ||
|
|
||
| It "Should have the expected new repository name - by Elements" { | ||
| $renamedRepo = Rename-GitHubRepository -OwnerName $repo.owner.login -RepositoryName $repo.name -NewName $newRepoName -Confirm:$false | ||
| $renamedRepo.Name | Should be $newRepoName | ||
| } | ||
| ## cleanup temp testing repository | ||
| AfterEach -Scriptblock { | ||
| ## variables from BeforeEach scriptblock are accessible here, but not variables from It scriptblocks, so need to make URI (instead of being able to use $renamedRepo variable from It scriptblock) | ||
| Remove-GitHubRepository -Uri "$($repo.svn_url)$suffixToAddToRepo" -Verbose | ||
| } | ||
| } | ||
| } | ||
| } | ||
| finally | ||
| { | ||
| if (Test-Path -Path $script:originalConfigFile -PathType Leaf) | ||
| { | ||
| # Restore the user's configuration to its pre-test state | ||
| Restore-GitHubConfiguration -Path $script:originalConfigFile | ||
| $script:originalConfigFile = $null | ||
| } | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.