diff --git a/tests/pester-tests/commands/choco-info.Tests.ps1 b/tests/pester-tests/commands/choco-info.Tests.ps1 index bc3eaa1a4..bc4a21f85 100644 --- a/tests/pester-tests/commands/choco-info.Tests.ps1 +++ b/tests/pester-tests/commands/choco-info.Tests.ps1 @@ -12,6 +12,27 @@ Remove-ChocolateyTestInstall } + Context "Should include remembered arguments (including redacted) when using option --local-only" { + BeforeAll { + Remove-NuGetPaths + Initialize-ChocolateyTestInstall -Source $PSScriptRoot\testpackages + Invoke-Choco install installpackage --package-parameters="bob" --user="bill" --password="secure-password" --confirm + + $Output = Invoke-Choco info installpackage --local-only + } + + It "Exits with Success (0)" { + $Output.ExitCode | Should -Be 0 -Because $Output.String + } + + It "Should contain a summary" { + $Output.Lines | Should -Contain "Remembered Package Arguments:" -Because $Output.String + $Output.Lines | Should -Contain "--package-parameters='bob'" -Because $Output.String + $Output.Lines | Should -Contain "--user=[REDACTED ARGUMENT]" -Because $Output.String + $Output.Lines | Should -Contain "--password=[REDACTED ARGUMENT]" -Because $Output.String + } + } + Context "Listing package information when package can be found" { BeforeDiscovery { $infoItems = @( @@ -187,11 +208,11 @@ } It 'Outputs warning about unable to load service index' { - $Output.Lines | Should -Contain "Unable to load the service index for source $InvalidSource." + $Output.Lines | Should -Contain "Unable to load the service index for source $InvalidSource." -Because $Output.String } It 'Output information about the package' { - $Output.String | Should -Match "Title: Chocolatey " + $Output.String | Should -Match "Title: Chocolatey " -Because $Output.String } }