35 lines
1.3 KiB
PowerShell
35 lines
1.3 KiB
PowerShell
. $PSScriptRoot\..\..\Load-PesterModules.ps1
|
|
$here = Split-Path -Parent $MyInvocation.MyCommand.Path
|
|
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.tests\.', '.'
|
|
$functionPath = Join-Path -Path $here -ChildPath $sut
|
|
Write-Host "Overriding SUT: $functionPath"
|
|
Import-Module $functionPath -Force
|
|
$moduleForMock = ""
|
|
|
|
Describe Get-SecurityPolicySetting {
|
|
|
|
$mockedLogonSID = "S-1-2-3-420-8675309"
|
|
$mockedProfileSID = "S-6-6-6-666666"
|
|
|
|
mock -ModuleName $moduleForMock Get-SecurityPolicy {
|
|
$mockedLogonSID = "S-1-2-3-420-8675309"
|
|
$mockedProfileSID = "S-6-6-6-666666"
|
|
$mockedSecurityPolicyContent = @('[Privilege Rights]', "SeServiceLogonRight = *S-1-1-1-11111,*$mockedLogonSID", "SeSystemProfilePrivilege = *S-1-1-1-11111,*$mockedProfileSID")
|
|
return $mockedSecurityPolicyContent
|
|
}
|
|
|
|
Context "Returns a SID for a given setting" {
|
|
|
|
it "Returns SID for SeServiceLogonRight" {
|
|
$result = Get-SecurityPolicySetting -settingName "SeServiceLogonRight"
|
|
|
|
$result | should -BeLike *$mockedLogonSID*
|
|
}
|
|
it "Returns SID for SeSystemProfilePrivilege" {
|
|
$result = Get-SecurityPolicySetting -settingName "SeSystemProfilePrivilege"
|
|
|
|
$result | should -BeLike *$mockedProfileSID*
|
|
}
|
|
}
|
|
}
|