Fix Install PackageProvider failure because we are not running on administrator

This commit is contained in:
quoctruong91 committed 2016-07-12 21:17:11 -07:00
1 parent c978927947
commit 50c3e5bfc8
4 files changed
+14 -11

No files matched your search

@@ -27,7 +27,6 @@ Describe "Get-package" -Tags @('BVT', 'DRT'){
Describe "Get-package with version parameter - valid scenarios" -Tags @('BVT', 'DRT'){
$destination = Join-Path $TestDrive GetPackageTests
$destination > C:\test.txt
It "Get-package supports -AllVersions parameter" -Skip {
$outputWithAllVersions = (Get-Package -providername Programs,Msi -AllVersions)
@@ -80,4 +79,4 @@ Describe "Get-package with version parameter - Error scenarios" -Tags @('BVT', '
$ERROR[0].FullyQualifiedErrorId | should be "VersionRangeAndRequiredVersionCannotBeSpecifiedTogether,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackage"
}
}
}
@@ -742,38 +742,38 @@ Describe "install-packageprovider Error Cases" -Tags @('BVT', 'DRT') {
It "EXPECTED: returns an error when asking for a provider that does not exist" {
$Error.Clear()
install-packageprovider -name NOT_EXISTS -warningaction:silentlycontinue -ea silentlycontinue
install-packageprovider -name NOT_EXISTS -Scope CurrentUser -warningaction:silentlycontinue -ea silentlycontinue
$ERROR[0].FullyQualifiedErrorId | should be "NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider"
}
It "EXPECTED: returns an error when asking for a provider with RequiredVersoin and MinimumVersion" {
$Error.Clear()
install-packageprovider -name NOT_EXISTS -RequiredVersion 1.0 -MinimumVersion 2.0 -warningaction:silentlycontinue -ea silentlycontinue
install-packageprovider -name NOT_EXISTS -Scope CurrentUser -RequiredVersion 1.0 -MinimumVersion 2.0 -warningaction:silentlycontinue -ea silentlycontinue
$ERROR[0].FullyQualifiedErrorId | should be "VersionRangeAndRequiredVersionCannotBeSpecifiedTogether,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider"
}
It "EXPECTED: returns an error when asking for a provider with RequiredVersoin and MaximumVersion" {
$Error.Clear()
install-packageprovider -name NOT_EXISTS -RequiredVersion 1.0 -MaximumVersion 2.0 -warningaction:silentlycontinue -ea silentlycontinue
install-packageprovider -name NOT_EXISTS -Scope CurrentUser -RequiredVersion 1.0 -MaximumVersion 2.0 -warningaction:silentlycontinue -ea silentlycontinue
$ERROR[0].FullyQualifiedErrorId | should be "VersionRangeAndRequiredVersionCannotBeSpecifiedTogether,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider"
}
It "EXPECTED: returns an error when asking for a provider with a MinimumVersion greater than MaximumVersion" {
$Error.Clear()
install-packageprovider -name nuget -MaximumVersion 1.0 -MinimumVersion 2.0 -warningaction:silentlycontinue -ea silentlycontinue
install-packageprovider -name nuget -Scope CurrentUser -MaximumVersion 1.0 -MinimumVersion 2.0 -warningaction:silentlycontinue -ea silentlycontinue
$ERROR[0].FullyQualifiedErrorId | should be "NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider"
}
It "EXPECTED: returns an error when asking for a provider with MinimumVersion that does not exist" {
$Error.Clear()
install-packageprovider -name gistprovider -MinimumVersion 20.2 -warningaction:silentlycontinue -ea silentlycontinue
install-packageprovider -name gistprovider -MinimumVersion 20.2 -warningaction:silentlycontinue -Scope CurrentUser -ea silentlycontinue
$ERROR[0].FullyQualifiedErrorId | should be "NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider"
}
It "EXPECTED: returns an error when asking for a provider with MaximumVersion that does not exist" {
$Error.Clear()
install-packageprovider -name gistprovider -MaximumVersion 0.1 -warningaction:silentlycontinue -ea silentlycontinue
install-packageprovider -name gistprovider -Scope CurrentUser -MaximumVersion 0.1 -warningaction:silentlycontinue -ea silentlycontinue
$ERROR[0].FullyQualifiedErrorId | should be "NoMatchFoundForProvider,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackageProvider"
}
}
@@ -548,7 +548,7 @@ Describe Save-Package -Tags @('BVT', 'DRT'){
it "EXPECTED: Saves 'Zlib' Package To Packages Directory" {
$version = "1.2.8.8"
$expectedPackages = @("zlib", "zlib.v120.windesktop.msvcstl.dyn.rt-dyn", "zlib.v140.windesktop.msvcstl.dyn.rt-dyn")
$newDestination = "$env:tmp\nugetinstallation"
$newDestination = Join-Path $TestDrive "nugetinstallation"
try {
$packages = Save-Package -Name "zlib" -ProviderName $nuget -Source $source -RequiredVersion $version -ForceBootstrap -Path $destination
@@ -1639,4 +1639,4 @@ Describe Test-Proxy -Tags @('BVT', 'DRT') {
}
}
}
}