Skip to content

Commit edbf4f5

Browse files
Rajath Agasthyaaramprice
authored andcommitted
Fix Clear-ProxySettings test
Modified the Clear-ProxySettings function to specifically check for DefaultConnectionSettings property rather than checking for any properties. This is required because other tests in the file create proxy settings.
1 parent 614bdc0 commit edbf4f5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

modules/BOSH.Utils/BOSH.Utils.Tests.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,8 @@ Describe "BOSH.Utils" {
425425

426426
$item = Get-Item $regKeyConnections
427427

428-
#DefaultConnectionSettings is actually added to a "Property" object
429-
$item.Property | Should -Be $null
428+
#DefaultConnectionSettings should be removed
429+
$item.Property -contains "DefaultConnectionSettings" | Should -Be $false
430430

431431
#We need to pipe the netsh command through Out-String in order to convert its output into a proper string
432432
$output = (netsh winhttp show proxy) | Out-String

modules/BOSH.Utils/BOSH.Utils.psm1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,9 +236,9 @@ function Clear-ProxySettings
236236
{
237237
$regKeyConnections = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections"
238238
$item = Get-Item $regKeyConnections
239-
if ($item.Property)
239+
if ($item.Property -contains "DefaultConnectionSettings")
240240
{
241-
Remove-ItemProperty "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections" -Name "DefaultConnectionSettings"
241+
Remove-ItemProperty -Path $regKeyConnections -Name "DefaultConnectionSettings"
242242

243243
#We need to pipe the command through Out-String in order to convert its output into a proper string
244244
$reset_proxy = (& cmd.exe /c "netsh winhttp reset proxy") | Out-String

0 commit comments

Comments
 (0)