File size: 1,629 Bytes
8c763fb | 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 51 | # Copyright (c) Microsoft Corporation.
# 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
}
}
}
|