예제 #1
0
func Test_DefaultProvider_LookupGroupId(t *testing.T) {
	current := getCurrentUser(t)
	uip := GetDefaultProvider()

	g1, err := group.LookupID(current.Gid)
	if err != nil {
		t.Fatalf("Can't look up current group directly: %s", err.Error())
	}

	g2, err := uip.LookupGroupId(current.Gid)
	if err != nil {
		t.Fatalf("Can't look up current group via provider: %s", err.Error())
	}

	assert.Equal(t, g1.Gid, g2.Gid)
}
예제 #2
0
func Test_DefaultProvider_LookupGroup(t *testing.T) {
	current := getCurrentUser(t)
	uip := GetDefaultProvider()

	g1, err := group.LookupID(current.Gid)
	if err != nil {
		t.Fatalf("Can't look up current group by ID directly: %s", err.Error())
	}

	g1b, err := group.Lookup(g1.Name)
	if err != nil {
		t.Fatalf("Can't look up current group by name directly: %s", err.Error())
	}

	g2, err := uip.LookupGroup(g1.Name)
	if err != nil {
		t.Fatalf("Can't look up current user via provider: %s", err.Error())
	}

	assert.Equal(t, g1.Name, g1b.Name, "group module failure")
	assert.Equal(t, g1b.Name, g2.Name, "shim failure")
}
예제 #3
0
func (p defaultProvider) LookupGroupId(gid string) (*group.Group, error) {
	return group.LookupID(gid)
}