Skip to content
This repository was archived by the owner on Jun 13, 2024. It is now read-only.

Commit 7e816e4

Browse files
committed
produce a warning for Set-PackageSource (if the new url ends in api/v2)
1 parent 3e69389 commit 7e816e4

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

Tests/Pester.PSRepository.Tests.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,11 @@ Describe 'Managing repositories' -Tag BVT {
263263
$warning | Should BeLike "*Unable to reach URL*"
264264
}
265265

266+
It "Should let you update a package source but produce a warning" {
267+
Register-PackageSource NewRepo -Location https://microsoft.com/api/v2 -ProviderName powershellget -WarningAction SilentlyContinue
268+
Set-PackageSource -Name NewRepo -Location https://microsoft.com/api/v2 -NewLocation https://docs.microsoft.com/api/v2 -ProviderName powershellget -WarningVariable warning -WarningAction SilentlyContinue
269+
$warning | Should BeLike "*Unable to reach URL 'https://docs*"
270+
}
266271

267272
It "Should not let you register 2 repositories which differ only by /" {
268273
Register-PSRepository -Name NewRepo -SourceLocation "https://nowhere.com/api/v2" -WarningAction SilentlyContinue

src/PowerShellGet/private/functions/Get-ValidModuleLocation.ps1

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function Get-ValidModuleLocation
5858
-Proxy $Proxy `
5959
-ProxyCredential $ProxyCredential `
6060
-ErrorAction SilentlyContinue `
61-
-SkipLocationWarning
61+
-SkipLocationWarning
6262
if($tempLocation)
6363
{
6464
return $tempLocation
@@ -73,8 +73,7 @@ function Get-ValidModuleLocation
7373
-Credential $Credential `
7474
-Proxy $Proxy `
7575
-ProxyCredential $ProxyCredential `
76-
-CallerPSCmdlet $PSCmdlet `
77-
-SkipLocationWarning
76+
-CallerPSCmdlet $PSCmdlet
7877
}
7978

8079
return $LocationString

0 commit comments

Comments
 (0)