MCPcopy
hub / github.com/purpleidea/mgmt / TestUserValidate_NameInGroups

Function TestUserValidate_NameInGroups

engine/resources/user_test.go:601–608  ·  view source on GitHub ↗

TestUserValidate_NameInGroups asserts that the user's own name (which is the conventional primary-group name on most distros) is rejected from the supplemental Groups list.

(t *testing.T)

Source from the content-addressed store, hash-verified

599// conventional primary-group name on most distros) is rejected from the
600// supplemental Groups list.
601func TestUserValidate_NameInGroups(t *testing.T) {
602 res := mkUser("james", "exists", func(r *UserRes) {
603 r.Groups = []string{"james", "wheel"}
604 })
605 if err := res.Validate(); err == nil {
606 t.Error("expected error when user name appears in Groups; got nil")
607 }
608}
609
610// TestUserCheckApply_AbsentSkipsUIDConflict guards against the duplicate-UID
611// check firing for users we want absent. If the resource asks for `ghost` to be

Callers

nothing calls this directly

Calls 3

mkUserFunction · 0.85
ValidateMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected