diff --git a/tests/pester-tests/features/CygwinSource.Tests.ps1 b/tests/pester-tests/features/CygwinSource.Tests.ps1 new file mode 100644 index 0000000000..90f3b78ef6 --- /dev/null +++ b/tests/pester-tests/features/CygwinSource.Tests.ps1 @@ -0,0 +1,30 @@ +Import-Module helpers/common-helpers + +# This is skipped when not run in CI because it modifies the local system. +Describe "Cygwin Source" -Tag Chocolatey, CygwinSource -Skip:(-not $env:TEST_KITCHEN) { + BeforeAll { + Initialize-ChocolateyTestInstall + New-ChocolateyInstallSnapshot + Enable-ChocolateySource -Name hermes-setup + $null = Invoke-Choco install cygwin + } + + AfterAll { + $null = Invoke-Choco uninstall cygwin --remove-dependencies + Remove-ChocolateyTestInstall + } + + Context "install all" { + BeforeAll { + $Output = Invoke-Choco install all --source=cygwin + } + + It 'Exits with exit code (1)' { + $Output.ExitCode | Should -Be 1 -Because $Output.String + } + + It 'Outputs exception' { + $Output.Lines | Should -Contain "Alternative sources do not allow the use of the 'all' package name/keyword." -Because $Output.String + } + } +} \ No newline at end of file diff --git a/tests/pester-tests/features/PythonSource.Tests.ps1 b/tests/pester-tests/features/PythonSource.Tests.ps1 index 63d91cf424..2a0aad6b67 100644 --- a/tests/pester-tests/features/PythonSource.Tests.ps1 +++ b/tests/pester-tests/features/PythonSource.Tests.ps1 @@ -27,12 +27,29 @@ Describe "Python Source" -Tag Chocolatey, UpgradeCommand, PythonSource, ProxySki } It 'Exits with correct exit code ()' { - $Output.ExitCode | Should -Be $ExitCode + $Output.ExitCode | Should -Be $ExitCode -Because $Output.String } It 'Outputs properly' { - $Output.Lines | Should -Not:($ExitCode -eq 0) -Contain "Alternative sources do not allow the use of the 'all' package name/keyword." - $Output.Lines | Should -Contain "Chocolatey upgraded $Count/$Count packages." + $Output.Lines | Should -Not:($ExitCode -eq 0) -Contain "Alternative sources do not allow the use of the 'all' package name/keyword." -Because $Output.String + $Output.Lines | Should -Contain "Chocolatey upgraded $Count/$Count packages." -Because $Output.String + } + } + + Context "install all" { + BeforeAll { + # For some reason under kitchen-pester we don't have pip on the path. This might be due to our snapshotting... + Import-Module $env:ChocolateyInstall/helpers/ChocolateyProfile.psm1 + Update-SessionEnvironment + $Output = Invoke-Choco install all --source=python + } + + It 'Exits with exit code (1)' { + $Output.ExitCode | Should -Be 1 -Because $Output.String + } + + It 'Outputs exception' { + $Output.Lines | Should -Contain "Alternative sources do not allow the use of the 'all' package name/keyword." -Because $Output.String } } } diff --git a/tests/pester-tests/features/RubySource.Tests.ps1 b/tests/pester-tests/features/RubySource.Tests.ps1 new file mode 100644 index 0000000000..83aba65f82 --- /dev/null +++ b/tests/pester-tests/features/RubySource.Tests.ps1 @@ -0,0 +1,30 @@ +Import-Module helpers/common-helpers + +# This is skipped when not run in CI because it modifies the local system. +Describe "Ruby Source" -Tag Chocolatey, RubySource -Skip:(-not $env:TEST_KITCHEN) { + BeforeAll { + Initialize-ChocolateyTestInstall + New-ChocolateyInstallSnapshot + Enable-ChocolateySource -Name hermes-setup + $null = Invoke-Choco install ruby.portable + } + + AfterAll { + $null = Invoke-Choco uninstall ruby.portable --remove-dependencies + Remove-ChocolateyTestInstall + } + + Context "install all" { + BeforeAll { + $Output = Invoke-Choco install all --source=ruby + } + + It 'Exits with exit code (1)' { + $Output.ExitCode | Should -Be 1 -Because $Output.String + } + + It 'Outputs exception' { + $Output.Lines | Should -Contain "Alternative sources do not allow the use of the 'all' package name/keyword." -Because $Output.String + } + } +} \ No newline at end of file diff --git a/tests/pester-tests/features/WindowsFeaturesSource.Tests.ps1 b/tests/pester-tests/features/WindowsFeaturesSource.Tests.ps1 new file mode 100644 index 0000000000..53bd633ea0 --- /dev/null +++ b/tests/pester-tests/features/WindowsFeaturesSource.Tests.ps1 @@ -0,0 +1,26 @@ +Import-Module helpers/common-helpers + +Describe "Windows Features Source" -Tag Chocolatey, WindowsFeaturesSource { + BeforeAll { + Initialize-ChocolateyTestInstall + New-ChocolateyInstallSnapshot + } + + AfterAll { + Remove-ChocolateyTestInstall + } + + Context "install all" { + BeforeAll { + $Output = Invoke-Choco install all --source=windowsfeatures + } + + It 'Exits with exit code (1)' { + $Output.ExitCode | Should -Be 1 -Because $Output.String + } + + It 'Outputs exception' { + $Output.Lines | Should -Contain "Alternative sources do not allow the use of the 'all' package name/keyword." -Because $Output.String + } + } +} \ No newline at end of file