Skip to content

Commit 1efb9ff

Browse files
author
Rajath Agasthya
committed
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 a5a48b2 commit 1efb9ff

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
@@ -427,8 +427,8 @@ Describe "BOSH.Utils" {
427427

428428
$item = Get-Item $regKeyConnections
429429

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

433433
#We need to pipe the netsh command through Out-String in order to convert its output into a proper string
434434
$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)