Skip to content

Commit d29518a

Browse files
author
Steve Lee (POWERSHELL HE/HIM) (from Dev Box)
committed
add test
1 parent f41e6a2 commit d29518a

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

registry/tests/registry.config.get.tests.ps1

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,18 @@ Describe 'Registry config get tests' {
3030
$result.valueData.ExpandString | Should -Be '%ProgramFiles%'
3131
($result.psobject.properties | Measure-Object).Count | Should -Be 3
3232
}
33+
34+
It 'Traces should be JSON' -Skip:(!$IsWindows) {
35+
# keyPath should return Access Denied
36+
$json = @'
37+
{
38+
"keyPath": "HKLM\\SYSTEM\\CurrentControlSet\\Control\\SecurePipeServers\\Winreg"
39+
}
40+
'@
41+
$out = registry config get --input $json 2>&1
42+
$LASTEXITCODE | Should -Be 3
43+
$result = $out | ConvertFrom-Json
44+
$result.level | Should -BeExactly 'ERROR'
45+
$result.fields.message | Should -BeLike '*Permission denied*'
46+
}
3347
}

0 commit comments

Comments
 (0)