Example #1
0
func (t *GroupRegistryTest) LookUpWheelGroup() {
	// Ask the os package for the wheel group.
	osGroup, err := group.Lookup("wheel")
	AssertEq(nil, err)

	AssertNe("", osGroup.Groupname)
	AssertNe("", osGroup.Gid)

	osGid, err := strconv.Atoi(osGroup.Gid)
	AssertEq(nil, err)

	// Look it up in both ways.
	groupname, err := t.registry.FindById(sys.GroupId(osGid))
	AssertEq(nil, err)
	ExpectEq("wheel", groupname)

	gid, err := t.registry.FindByName("wheel")
	AssertEq(nil, err)
	ExpectEq(sys.GroupId(osGid), gid)
}
Example #2
0
func (t *GroupRegistryTest) LookUpCurrentGroup() {
	// Ask the os package for the current group.
	osGroup, err := group.Current()
	AssertEq(nil, err)

	AssertNe("", osGroup.Groupname)
	AssertNe("", osGroup.Gid)

	osGid, err := strconv.Atoi(osGroup.Gid)
	AssertEq(nil, err)
	AssertNe(0, osGid)

	// Look it up in both ways.
	groupname, err := t.registry.FindById(sys.GroupId(osGid))
	AssertEq(nil, err)
	ExpectEq(osGroup.Groupname, groupname)

	gid, err := t.registry.FindByName(osGroup.Groupname)
	AssertEq(nil, err)
	ExpectEq(sys.GroupId(osGid), gid)
}