1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-22 16:45:58 +01:00

Fix TestPermissions.

This was broken when we moved GetPermission to Group.
Thanks to kiufta.
This commit is contained in:
Juliusz Chroboczek 2022-09-09 14:13:24 +02:00
parent 6bdcd504a7
commit 74a1243947

View file

@ -159,15 +159,15 @@ var goodClients = []credPerm{
} }
func TestPermissions(t *testing.T) { func TestPermissions(t *testing.T) {
var d Description var g Group
err := json.Unmarshal([]byte(descJSON), &d) err := json.Unmarshal([]byte(descJSON), &g.description)
if err != nil { if err != nil {
t.Fatalf("unmarshal: %v", err) t.Fatalf("unmarshal: %v", err)
} }
for _, c := range badClients { for _, c := range badClients {
t.Run("bad "+c.Username, func(t *testing.T) { t.Run("bad "+c.Username, func(t *testing.T) {
_, p, err := d.GetPermission("test", c) _, p, err := g.GetPermission(c)
if err != ErrNotAuthorised { if err != ErrNotAuthorised {
t.Errorf("GetPermission %v: %v %v", c, err, p) t.Errorf("GetPermission %v: %v %v", c, err, p)
} }
@ -176,7 +176,7 @@ func TestPermissions(t *testing.T) {
for _, cp := range goodClients { for _, cp := range goodClients {
t.Run("good "+cp.c.Username, func(t *testing.T) { t.Run("good "+cp.c.Username, func(t *testing.T) {
u, p, err := d.GetPermission("test", cp.c) u, p, err := g.GetPermission(cp.c)
if err != nil { if err != nil {
t.Errorf("GetPermission %v: %v", cp.c, err) t.Errorf("GetPermission %v: %v", cp.c, err)
} else if u != cp.c.Username || } else if u != cp.c.Username ||