-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTest-OrgFileShareAcl.tests.ps1
32 lines (22 loc) · 1.08 KB
/
Test-OrgFileShareAcl.tests.ps1
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
BeforeAll {
Remove-Module Sysadmin -Force
Import-Module "$PSScriptRoot\..\Sysadmin\Sysadmin.psd1" -Force
Mock -ModuleName Sysadmin -CommandName Test-Path -MockWith { $true }
# TODO: Mock Get-Acl, using ParameterFilter to mock different results (an assumed bad ACL versus a good ACL)
Mock -ModuleName Sysadmin -CommandName Get-Acl -ParameterFilter { $Path -eq '\\example.com\Files\Business Unit\Bad Share' } -MockWith { throw 'Not mocked yet' }
Mock -ModuleName Sysadmin -CommandName Get-Acl -ParameterFilter { $Path -eq '\\example.com\Files\Business Unit\Good Share' } -MockWith { throw 'Not mocked yet' }
}
Describe 'Test-OrgFileShareAcl' {
Context 'when the ACL is correct' {
It 'returns true' {
$Path = '\\example.com\Files\Business Unit\Good Share'
Test-OrgFileShareAcl -Path $Path | Should -Be $true
}
}
Context 'when the ACL is incorrect' {
It 'returns false' {
$Path = '\\example.com\Files\Business Unit\Bad Share'
Test-OrgFileShareAcl -Path $Path | Should -Be $false
}
}
}