Created
August 10, 2017 12:17
-
-
Save duffney/793d33d5e603b1d5a7c36aae9f1ce80b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$here = Split-Path -Parent $MyInvocation.MyCommand.Path | |
$sut = (Split-Path -Leaf $MyInvocation.MyCommand.Path) -replace '\.Tests\.', '.' | |
. "$here\$sut" | |
Describe "Add-ACLAccessRule Tests" { | |
New-Item -Name Logs -Path 'TestDrive:' -ItemType Directory | |
$application = 'DevOpsTest' | |
$splat = @{ | |
Path = 'TestDrive:\Logs' | |
IdentityReference = 'Everyone' | |
AccessControlType = 'Allow' | |
FileSystemRights = 'Modify' | |
InheritanceFlags = 'ObjectInherit,ContainerInherit' | |
PropagationFlags = 'None' | |
} | |
Add-AclAccessRule @splat | |
$ACL = (Get-Item $($splat.Path)).GetAccessControl('Access').Access | Where-Object IdentityReference -Match $($splat.IdentityReference) | |
it "Logs dir should exist" { | |
Test-Path 'TestDrive:\Logs' | should be $true | |
} | |
it "should Not BeNullorEmpty" { | |
$ACL | should not BeNullorEmpty | |
} | |
it "IdentityReference should be [$application]" { | |
$ACL.IdentityReference | should belike "*$($splat.IdentityReference)*" | |
} | |
it "FileSystemRights should be Modify" { | |
$ACL.FileSystemRights | should be 'Modify, Synchronize' | |
} | |
it "AccessControlType should be Allow" { | |
$ACL.AccessControlType | should be 'Allow' | |
} | |
it "IsInherited shoud be False" { | |
$ACL.IsInherited | should be 'False' | |
} | |
it "InheritanceFlags should be ContainerInherit, ObjectInherit" { | |
$ACL.InheritanceFlags | should be 'ContainerInherit, ObjectInherit' | |
} | |
it "PropagationFlags should be None" { | |
$ACL.PropagationFlags | should be 'None' | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment