-
Notifications
You must be signed in to change notification settings - Fork 156
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Description for Azure RMService Connection (#516)
feat: add description field to Add-VSTeamAzureRMServiceEndpoint cmdlet * Update Add-VSTeamAzureRMServiceEndpoint.ps1 to include description field * Create Add-VSTeamAzureRMServiceEndpoint.Tests.ps1 for tests * Update CHANGELOG.md to reflect changes * Update cmdlet name to VSTeamAzureRMServiceEndpoint * Add necessary mocks and fix typos in tests
- Loading branch information
1 parent
9c2133f
commit e8be72c
Showing
5 changed files
with
49 additions
and
3 deletions.
There are no files selected for viewing
This file contains 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 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 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
36 changes: 36 additions & 0 deletions
36
Tests/function/tests/Add-VSTeamAzureRMServiceEndpoint.Tests.ps1
This file contains 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,36 @@ | ||
Set-StrictMode -Version Latest | ||
|
||
Describe 'Add-VSTeamAzureRMServiceEndpoint' { | ||
BeforeAll { | ||
. "$PSScriptRoot\_testInitialize.ps1" $PSCommandPath | ||
. "$baseFolder/Source/Public/Add-VSTeamServiceEndpoint.ps1" | ||
. "$baseFolder/Source/Public/Get-VSTeamServiceEndpoint.ps1" | ||
} | ||
|
||
Context 'Add-VSTeamAzureRMServiceEndpoint' { | ||
BeforeAll { | ||
Mock _getInstance { return 'https://dev.azure.com/test' } | ||
Mock _getApiVersion { return '1.0-unitTests' } -ParameterFilter { $Service -eq 'ServiceEndpoints' } | ||
|
||
Mock Write-Progress | ||
Mock Invoke-RestMethod { _trackProcess } | ||
Mock Invoke-RestMethod { return @{id = '23233-2342' } } -ParameterFilter { $Method -eq 'Post' } | ||
} | ||
|
||
It 'should create a new Azure RM Serviceendpoint' { | ||
Add-VSTeamAzureRMServiceEndpoint -projectName 'projectName'` | ||
-SubscriptionName 'SubscriptionName' ` | ||
-SubscriptionId 'SubscriptionId' ` | ||
-SubscriptionTenantId '00000000-0000-0000-0000-000000000000' ` | ||
-ServicePrincipalId '00000000-0000-0000-0000-000000000000' ` | ||
-ServicePrincipalKey 'clientsecret' ` | ||
-EndpointName 'AzureRMTest' ` | ||
-Description 'description here' | ||
|
||
# On PowerShell 5 the JSON has two spaces but on PowerShell 6 it only has one so | ||
# test for both. | ||
Should -Invoke Invoke-RestMethod -Exactly -Scope It -Times 1 -ParameterFilter { | ||
$Method -eq 'Post' } | ||
} | ||
} | ||
} |
This file contains 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