File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Copyright (c) Microsoft Corporation.
2
+ # Copyright (c) Microsoft Corporation.
3
+ # Licensed under the MIT License.
4
+
5
+ # Add Pester test to check the API for GroupPolicyEnforcement
6
+
7
+ Describe ' GroupPolicyEnforcement API Tests' {
8
+ BeforeAll {
9
+ # Setup code if needed
10
+ }
11
+
12
+ AfterAll {
13
+ # Cleanup code if needed
14
+ }
15
+
16
+ It ' Should return the correct policy enforcement status' {
17
+
18
+ try {
19
+ $expectedStatus = ' Disabled'
20
+ $actualStatus = [Microsoft.PowerShell.PSResourceGet.Cmdlets.GroupPolicyRepositoryEnforcement ]::IsGroupPolicyEnabled()
21
+ $actualStatus | Should - Be $expectedStatus
22
+ }
23
+ finally {
24
+
25
+ }
26
+
27
+ }
28
+
29
+ It ' Should throw an error for invalid policy name' {
30
+ # Arrange
31
+ $invalidPolicyName = ' InvalidPolicy'
32
+
33
+ # Act & Assert
34
+ { Get-GroupPolicyEnforcementStatus - PolicyName $invalidPolicyName } | Should - Throw
35
+ }
36
+
37
+ It ' Should return a list of all enforced policies' {
38
+ # Act
39
+ $policies = Get-AllEnforcedPolicies
40
+
41
+ # Assert
42
+ $policies | Should -Not - BeNullOrEmpty
43
+ $policies | Should - BeOfType ' System.Collections.Generic.List[System.String]'
44
+ }
45
+ }
You can’t perform that action at this time.
0 commit comments