forked from PowerShell/PowerShell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConvertFrom-SddlString.ps1
More file actions
50 lines (42 loc) · 1.61 KB
/
Copy pathConvertFrom-SddlString.ps1
File metadata and controls
50 lines (42 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
Describe "ConvertFrom-SddlString Tests" -Tags "CI", "RequireAdminOnWindows" {
BeforeAll {
if (-not $IsWindows) { return }
$sddl = (Get-Item -Path WSMan:\localhost\Service\RootSDDL).Value
$testCases = @(
@{ Type = "_UNSPECIFIED_" }
@{ Type = "FileSystemRights" }
@{ Type = "RegistryRights" }
@{ Type = "ActiveDirectoryRights" }
@{ Type = "MutexRights" }
@{ Type = "SemaphoreRights" }
@{ Type = "EventWaitHandleRights" }
)
$expectedProperties = @('Owner', 'Group', 'DiscretionaryAcl', 'SystemAcl', 'RawDescriptor')
}
It "Validate ConvertFrom-SddlString with type <Type>" -Skip:(!$IsWindows) -TestCases $testCases {
param($Type)
$arguments = @{ Sddl = $sddl; }
if ($Type -ne "_UNSPECIFIED_") {
$arguments.Add("Type", $Type)
}
$result = ConvertFrom-SddlString @arguments
foreach ($property in $expectedProperties)
{
$result.$property | Should -Not -Be $null
}
}
It "Validate that ConvertFrom-SddlString with type <Type> via ValueFromPipeline" -Skip:(!$IsWindows) -TestCases $testCases {
param($Type)
$arguments = @{ }
if ($Type -ne "_UNSPECIFIED_") {
$arguments.Add("Type", $Type)
}
$result = $sddl | ConvertFrom-SddlString @arguments
foreach ($property in $expectedProperties)
{
$result.$property | Should -Not -Be $null
}
}
}