1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-09 02:05:59 +01:00

More API tests.

This commit is contained in:
Juliusz Chroboczek 2024-06-01 17:04:28 +02:00
parent cf2dc406d5
commit 8db2e92cb9

View file

@ -4,6 +4,7 @@ import (
"errors"
"fmt"
"os"
"reflect"
"strings"
"sync"
"time"
@ -191,7 +192,7 @@ func TestApi(t *testing.T) {
var users []string
err = getJSON("/galene-api/v0/.groups/test/.users/", &users)
if err != nil || len(users) != 1 || users[0] != "jch" {
if err != nil || len(users) != 1 || users[0] != "jch" {
t.Errorf("Get users: %v %v", err, users)
}
@ -265,12 +266,30 @@ func TestApi(t *testing.T) {
t.Errorf("Get wildcard user: %v", err)
}
desc, err = group.GetDescription("test")
if err != nil {
t.Errorf("GetDescription: %v", err)
}
if !reflect.DeepEqual(user, *desc.WildcardUser) {
t.Errorf("Got %v, expected %v", desc.WildcardUser, user)
}
resp, err = do("DELETE", "/galene-api/v0/.groups/test/.wildcard-user",
"", "", "", "")
if err != nil || resp.StatusCode != http.StatusNoContent {
t.Errorf("Delete wildcard user: %v %v", err, resp.StatusCode)
}
desc, err = group.GetDescription("test")
if err != nil {
t.Errorf("GetDescription: %v", err)
}
if desc.WildcardUser != nil {
t.Errorf("Got %v, expected nil", desc.WildcardUser)
}
if len(desc.AuthKeys) != 1 {
t.Errorf("Keys: %v", len(desc.AuthKeys))
}