-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Supporting core * changes for checks * resolving some comments * checks * Adding L0 test * Changing minor version * adding more L0 tests * adding bool
- Loading branch information
1 parent
2cf5aae
commit f00f4c1
Showing
24 changed files
with
281 additions
and
408 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[CmdletBinding()] | ||
param() | ||
|
||
# Arrange. | ||
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1 | ||
$targetAzurePs = "4.1.0" | ||
Register-Mock Get-VstsInput { "FilePath" } -- -Name ScriptType -Require | ||
Register-Mock Get-VstsInput { "$PSScriptRoot/PerformsBasicFlow_TargetScript.ps1" } -- -Name ScriptPath | ||
Register-Mock Get-VstsInput { $targetAzurePs } -- -Name TargetAzurePs | ||
Register-Mock Get-VstsInput { 'arg1 arg2' } -- -Name ScriptArguments | ||
Register-Mock Get-VstsInput { "continue" } -- -Name errorActionPreference | ||
Register-Mock Get-VstsInput { $true } -- -Name FailOnStandardError | ||
Register-Mock Get-VstsInput { $false } -- -Name pwsh -AsBool | ||
Register-Mock Update-PSModulePathForHostedAgent | ||
Register-Mock Get-Module | ||
Register-Mock Initialize-AzModule | ||
Register-Mock Get-VstsEndpoint { @{auth = @{ scheme = "ServicePrincipal" }} } | ||
Register-Mock Remove-EndpointSecrets | ||
Register-Mock Disconnect-AzureAndClearContext | ||
Register-Mock Assert-VstsPath | ||
Register-Mock Invoke-VstsTool { } | ||
|
||
# Act. | ||
$actual = & $PSScriptRoot\..\AzurePowerShell.ps1 | ||
|
||
Assert-WasCalled Invoke-VstsTool -Times 1 | ||
Assert-WasCalled Invoke-VstsTool -ArgumentsEvaluator {($args | ConvertTo-Json) -like '*powershell.exe*'} |
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,27 @@ | ||
[CmdletBinding()] | ||
param() | ||
|
||
# Arrange. | ||
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1 | ||
$targetAzurePs = "4.1.0" | ||
Register-Mock Get-VstsInput { "FilePath" } -- -Name ScriptType -Require | ||
Register-Mock Get-VstsInput { "$PSScriptRoot/PerformsBasicFlow_TargetScript.ps1" } -- -Name ScriptPath | ||
Register-Mock Get-VstsInput { $targetAzurePs } -- -Name TargetAzurePs | ||
Register-Mock Get-VstsInput { 'arg1 arg2' } -- -Name ScriptArguments | ||
Register-Mock Get-VstsInput { "continue" } -- -Name errorActionPreference | ||
Register-Mock Get-VstsInput { $true } -- -Name FailOnStandardError | ||
Register-Mock Get-VstsInput { $true } -- -Name pwsh -AsBool | ||
Register-Mock Update-PSModulePathForHostedAgent | ||
Register-Mock Get-Module | ||
Register-Mock Initialize-AzModule | ||
Register-Mock Get-VstsEndpoint { @{auth = @{ scheme = "ServicePrincipal" }} } | ||
Register-Mock Remove-EndpointSecrets | ||
Register-Mock Disconnect-AzureAndClearContext | ||
Register-Mock Assert-VstsPath | ||
Register-Mock Invoke-VstsTool { } | ||
|
||
# Act. | ||
$actual = & $PSScriptRoot\..\AzurePowerShell.ps1 | ||
|
||
Assert-WasCalled Invoke-VstsTool -Times 1 | ||
Assert-WasCalled Invoke-VstsTool -ArgumentsEvaluator {($args | ConvertTo-Json) -like '*pwsh.exe*'} |
29 changes: 29 additions & 0 deletions
29
Tasks/AzurePowerShellV4/Tests/ChecksForWorkingDirectory.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,29 @@ | ||
[CmdletBinding()] | ||
param() | ||
|
||
# Arrange. | ||
. $PSScriptRoot\..\..\..\Tests\lib\Initialize-Test.ps1 | ||
$targetAzurePs = "4.1.0" | ||
$input_workingDirectory = "C:\Users" | ||
Register-Mock Get-VstsInput { "FilePath" } -- -Name ScriptType -Require | ||
Register-Mock Get-VstsInput { "$PSScriptRoot/PerformsBasicFlow_TargetScript.ps1" } -- -Name ScriptPath | ||
Register-Mock Get-VstsInput { $targetAzurePs } -- -Name TargetAzurePs | ||
Register-Mock Get-VstsInput { 'arg1 arg2' } -- -Name ScriptArguments | ||
Register-Mock Get-VstsInput { "continue" } -- -Name errorActionPreference | ||
Register-Mock Get-VstsInput { $true } -- -Name FailOnStandardError | ||
Register-Mock Get-VstsInput { $true } -- -Name pwsh -AsBool | ||
Register-Mock Get-VstsInput { $input_workingDirectory } -- -Name workingDirectory -Require | ||
Register-Mock Update-PSModulePathForHostedAgent | ||
Register-Mock Get-Module | ||
Register-Mock Initialize-AzModule | ||
Register-Mock Get-VstsEndpoint { @{auth = @{ scheme = "ServicePrincipal" }} } | ||
Register-Mock Remove-EndpointSecrets | ||
Register-Mock Disconnect-AzureAndClearContext | ||
Register-Mock Assert-VstsPath | ||
Register-Mock Invoke-VstsTool { } | ||
|
||
# Act. | ||
$actual = & $PSScriptRoot\..\AzurePowerShell.ps1 | ||
|
||
Assert-WasCalled Invoke-VstsTool -Times 1 | ||
Assert-WasCalled Invoke-VstsTool -ArgumentsEvaluator {($args | ConvertTo-Json) -like '*C:\\Users*'} |
31 changes: 0 additions & 31 deletions
31
Tasks/AzurePowerShellV4/Tests/DoesNotFailOnStandardError.ps1
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
Tasks/AzurePowerShellV4/Tests/DoesNotThrowForNativeCommandError.ps1
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.