Skip to content

Commit

Permalink
[Added] Tests for registry.pol spelling cases
Browse files Browse the repository at this point in the history
Signed-off-by: Davi Henrique <[email protected]>
  • Loading branch information
dangerousplay committed Sep 16, 2024
1 parent a02be93 commit e206a41
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 1 deletion.
22 changes: 21 additions & 1 deletion internal/ad/ad_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ func TestGetPolicies(t *testing.T) {
}},
},

// Policy class directory spelling cases
// Policy class directory and Registry.pol spelling cases
"Policy user directory is uppercase": {
gpoListArgs: []string{"gpoonly.com", "bob:uppercase-class"},
want: policies.Policies{GPOs: []policies.GPO{standardUserGPO("uppercase-class")}},
Expand All @@ -450,6 +450,26 @@ func TestGetPolicies(t *testing.T) {
{ID: "lowercase-class", Name: "lowercase-class-name", Rules: map[string][]entry.Entry{}}},
},
},
"User policy Registry.pol is lower case": {
gpoListArgs: []string{"gpoonly.com", "bob:lowercase-registry"},
want: policies.Policies{GPOs: []policies.GPO{standardUserGPO("lowercase-registry")}},
},
"Computer policy Registry.pol is lower case": {
objectName: hostname,
objectClass: ad.ComputerObject,
gpoListArgs: []string{"gpoonly.com", hostname + ":lowercase-registry"},
want: policies.Policies{GPOs: []policies.GPO{standardComputerGPO("lowercase-registry")}},
},
"User policy Registry.pol is mixed case": {
gpoListArgs: []string{"gpoonly.com", "bob:mixedcase-registry"},
want: policies.Policies{GPOs: []policies.GPO{standardUserGPO("mixedcase-registry")}},
},
"Computer policy Registry.pol is mixed case": {
objectName: hostname,
objectClass: ad.ComputerObject,
gpoListArgs: []string{"gpoonly.com", hostname + ":mixedcase-registry"},
want: policies.Policies{GPOs: []policies.GPO{standardComputerGPO("mixedcase-registry")}},
},

// Error cases
"Machine doesn’t match": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[General]
Version=1000
displayName=New Group Policy Object
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[General]
Version=1000
displayName=New Group Policy Object
Binary file not shown.
Binary file not shown.

0 comments on commit e206a41

Please sign in to comment.