|
120 | 120 | }
|
121 | 121 | }
|
122 | 122 |
|
123 |
| - It 'Should mock call to Get-SmbShare and return membership' { |
| 123 | + It 'Should return the correct access memberships' { |
124 | 124 | $getTargetResourceResult = Get-TargetResource @testParameters
|
125 | 125 |
|
126 | 126 | $getTargetResourceResult.ChangeAccess | Should -HaveCount 1
|
|
135 | 135 |
|
136 | 136 | $getTargetResourceResult.NoAccess | Should -HaveCount 1
|
137 | 137 | $getTargetResourceResult.NoAccess[0] | Should -BeIn $mockNoPermissionUserName
|
138 |
| - } |
139 | 138 |
|
140 |
| - It 'Should call the mock function Get-SmbShare' { |
141 |
| - $getTargetResourceResult = Get-TargetResource @testParameters |
142 | 139 | Assert-MockCalled Get-SmbShare -Exactly -Times 1 -Scope It
|
143 |
| - } |
144 |
| - |
145 |
| - It 'Should Call the mock function Get-SmbShareAccess' { |
146 |
| - $getTargetResourceResult = Get-TargetResource @testParameters |
147 | 140 | Assert-MockCalled Get-SmbShareAccess -Exactly -Times 1 -Scope It
|
148 | 141 | }
|
149 | 142 | }
|
|
179 | 172 | $getTargetResourceResult.ReadAccess | Should -HaveCount 0
|
180 | 173 | $getTargetResourceResult.FullAccess | Should -HaveCount 0
|
181 | 174 | $getTargetResourceResult.NoAccess | Should -HaveCount 0
|
182 |
| - } |
183 | 175 |
|
| 176 | + Assert-MockCalled Get-SmbShare -Exactly -Times 1 -Scope It |
| 177 | + } |
184 | 178 | }
|
185 | 179 | }
|
186 | 180 |
|
|
220 | 214 | }
|
221 | 215 |
|
222 | 216 | Context 'When no access permission is given' {
|
223 |
| - It 'Should call the correct mocks' { |
| 217 | + It 'Should throw the correct error' { |
224 | 218 | $setTargetResourceParameters = @{
|
225 | 219 | Name = $mockShareName
|
226 | 220 | Path = 'TestDrive:\Temp'
|
@@ -347,13 +341,12 @@ try
|
347 | 341 | Assert-MockCalled Remove-SmbShare -Exactly -Times 0 -Scope It
|
348 | 342 | }
|
349 | 343 | }
|
350 |
| - |
351 | 344 | }
|
352 | 345 | }
|
353 | 346 |
|
354 | 347 | Describe 'MSFT_SmbShare\Test-TargetResource' -Tag 'Test' {
|
355 | 348 | Context 'When the system is not in the desired state' {
|
356 |
| - Context 'When no members in provided in neither access permission collection' { |
| 349 | + Context 'When no member are provided in any of the access permission collections' { |
357 | 350 | BeforeAll {
|
358 | 351 | $testTargetResourceParameters = @{
|
359 | 352 | Name = $mockShareName
|
|
680 | 673 | }
|
681 | 674 | }
|
682 | 675 |
|
683 |
| - It 'Should call the correct mock' { |
| 676 | + It 'Should not throw an error and call the correct mocks' { |
684 | 677 | { Add-SmbShareAccessPermission @addSmbShareAccessPermissionParameters } | Should -Not -Throw
|
685 | 678 |
|
686 | 679 | <#
|
|
706 | 699 | }
|
707 | 700 | }
|
708 | 701 |
|
709 |
| - It 'Should call the correct mock' { |
| 702 | + It 'Should not throw an error and call the correct mocks' { |
710 | 703 | { Add-SmbShareAccessPermission @addSmbShareAccessPermissionParameters } | Should -Not -Throw
|
711 | 704 |
|
712 | 705 | <#
|
|
732 | 725 | }
|
733 | 726 | }
|
734 | 727 |
|
735 |
| - It 'Should call the correct mock' { |
| 728 | + It 'Should not throw an error and call the correct mocks' { |
736 | 729 | { Add-SmbShareAccessPermission @addSmbShareAccessPermissionParameters } | Should -Not -Throw
|
737 | 730 |
|
738 | 731 | <#
|
|
764 | 757 | }
|
765 | 758 | }
|
766 | 759 |
|
767 |
| - It 'Should call the correct mock' { |
| 760 | + It 'Should not throw an error and call the correct mocks' { |
768 | 761 | { Add-SmbShareAccessPermission @addSmbShareAccessPermissionParameters } | Should -Not -Throw
|
769 | 762 |
|
770 | 763 | <#
|
|
809 | 802 | }
|
810 | 803 | }
|
811 | 804 |
|
812 |
| - It 'Should call the correct mock' { |
| 805 | + It 'Should not throw an error and call the correct mocks' { |
813 | 806 | { Add-SmbShareAccessPermission @removeSmbShareAccessPermissionParameters } | Should -Not -Throw
|
814 | 807 |
|
815 | 808 | <#
|
|
860 | 853 | }
|
861 | 854 | }
|
862 | 855 |
|
863 |
| - It 'Should call the correct mock' { |
| 856 | + It 'Should not throw an error and call the correct mocks' { |
864 | 857 | { Remove-SmbShareAccessPermission @removeSmbShareAccessPermissionParameters } | Should -Not -Throw
|
865 | 858 |
|
866 | 859 | <#
|
|
887 | 880 | }
|
888 | 881 | }
|
889 | 882 |
|
890 |
| - It 'Should call the correct mocks' { |
| 883 | + It 'Should not throw an error and call the correct mocks' { |
891 | 884 | { Remove-SmbShareAccessPermission @removeSmbShareAccessPermissionParameters } | Should -Not -Throw
|
892 | 885 |
|
893 | 886 | <#
|
|
918 | 911 | }
|
919 | 912 | }
|
920 | 913 |
|
921 |
| - It 'Should call the correct mock' { |
| 914 | + It 'Should not throw an error and call the correct mocks' { |
922 | 915 | { Remove-SmbShareAccessPermission @removeSmbShareAccessPermissionParameters } | Should -Not -Throw
|
923 | 916 |
|
924 | 917 | <#
|
|
944 | 937 | }
|
945 | 938 | }
|
946 | 939 |
|
947 |
| - It 'Should call the correct mock' { |
| 940 | + It 'Should not throw an error and call the correct mocks' { |
948 | 941 | { Remove-SmbShareAccessPermission @removeSmbShareAccessPermissionParameters } | Should -Not -Throw
|
949 | 942 |
|
950 | 943 | <#
|
|
972 | 965 | }
|
973 | 966 | }
|
974 | 967 |
|
975 |
| - It 'Should call the correct mock' { |
| 968 | + It 'Should not throw an error and call the correct mocks' { |
976 | 969 | { Remove-SmbShareAccessPermission @removeSmbShareAccessPermissionParameters } | Should -Not -Throw
|
977 | 970 |
|
978 | 971 | Assert-MockCalled -CommandName Revoke-SmbShareAccess -Exactly -Times 4 -Scope 'It'
|
@@ -1015,7 +1008,7 @@ try
|
1015 | 1008 | }
|
1016 | 1009 | }
|
1017 | 1010 |
|
1018 |
| - It 'Should call the correct mock' { |
| 1011 | + It 'Should not throw an error and call the correct mocks' { |
1019 | 1012 | { Remove-SmbShareAccessPermission @removeSmbShareAccessPermissionParameters } | Should -Not -Throw
|
1020 | 1013 |
|
1021 | 1014 | <#
|
@@ -1092,7 +1085,7 @@ try
|
1092 | 1085 | }
|
1093 | 1086 | }
|
1094 | 1087 |
|
1095 |
| - Context 'When providing no member in either of the access permission collections' { |
| 1088 | + Context 'When not providing any members in any of the access permission collections' { |
1096 | 1089 | It 'Should throw the correct error' {
|
1097 | 1090 | # We must using splatting to test 'ValueFromRemainingArguments' parameter.
|
1098 | 1091 | $assertAccessPermissionParameters = @{
|
|
0 commit comments