diff --git a/tests/PythonPip3Dsc/PythonPip3Dsc.Tests.ps1 b/tests/PythonPip3Dsc/PythonPip3Dsc.Tests.ps1 index b10683ed..425340a4 100644 --- a/tests/PythonPip3Dsc/PythonPip3Dsc.Tests.ps1 +++ b/tests/PythonPip3Dsc/PythonPip3Dsc.Tests.ps1 @@ -108,11 +108,18 @@ Describe 'Pip3Package' { $whatIfState = @{ PackageName = 'itsdangerous' Version = '2.2.0' + Exist = $false } $pipPackage = [Pip3Package]$whatIfState + + # Uninstall to make sure it is not present + $pipPackage.Set() + + $pipPackage.Exist = $true + + # Call whatif to see if it "will" install $whatIf = $pipPackage.WhatIf() | ConvertFrom-Json - $whatIf.PackageName | Should -Be 'itsdangerous' $whatIf._metaData.whatIf | Should -Contain "Would install itsdangerous-$($whatIfState.Version)" @@ -120,14 +127,14 @@ Describe 'Pip3Package' { It 'Does not return whatif result if package is invalid' -Skip:(!$IsWindows) { $whatIfState = @{ - PackageName = 'itsdangerouss' + PackageName = 'invalidPackageName' } $pipPackage = [Pip3Package]$whatIfState $whatIf = $pipPackage.WhatIf() | ConvertFrom-Json - - $whatIf.PackageName | Should -Be 'itsdangerouss' + + $whatIf.PackageName | Should -Be 'invalidPackageName' $whatIf._metaData.whatIf | Should -Contain "ERROR: No matching distribution found for $($whatIfState.PackageName)" } }