Files
Warp/server/internal/roomserver/membership_test.go
T
tajniak81andClaude Opus 5 c96f88e994
CI / Test (ubuntu-latest) (push) Canceled after 0s
CI / Test (windows-latest) (push) Canceled after 0s
CI / Storage tests on PostgreSQL (push) Canceled after 0s
CI / Complement (federation off) (push) Canceled after 0s
CI / golangci-lint (push) Canceled after 0s
CI / Smoke test the binary (push) Canceled after 0s
Phase 3: rooms, local only
Implements PLAN.md Phase 3: the roomserver, the room half of storage, the
Client-Server room endpoints and the admin room endpoints. A client can now
create a room, invite, join, leave, kick, ban, send messages and state,
redact, name a room with an alias and find one in the public directory.
Nothing talks to another server; every operation that would need to is
refused with a message that says so rather than a bare M_FORBIDDEN.

roomserver: one input pipeline every event goes through, whatever sent it —
validate, authorise, resolve, persist, emit. The rules are not
reimplemented here; internal/matrix is pure library code and this is what
connects it to a database and to a room's history. The Client-Server
handlers do no authorisation of their own, deliberately: whether Alice may
kick Bob is a question about the room's power levels, and the one place
that is answered correctly is the authorisation rules inside the pipeline.

A mutex per room serialises writers. Two events racing into one room would
each read the same forward extremities, both become one, and fork the room
for no reason — which would then need state resolution to put back
together. State resolution is wired in anyway for the multi-extremity
case. It is unreachable from outside in this phase, and the alternative is
a pipeline that authorises against one arbitrary branch of a fork without
saying so.

Room versions 3 to 12 all work and are each tested end to end. Version 12
earns that coverage: its room ID is the create event's own ID, its create
event carries no room_id, and the create event is excluded from every other
event's auth_events — so the state auth.Check is given is the event's
auth_events plus the create event, which that version identifies by room ID
rather than citing.

createRoom sends the spec's events in the spec's order, each authorised
against what the ones before it produced. A failure part-way leaves an
incomplete room, which is the lesser evil: the alternative is holding every
event of a new room in memory and writing them in one transaction, making
the pipeline that authorises them a special case. The one failure a second
client can cause at any time, an alias clash, takes the room row back out.

Redactions stay two decisions, as the spec keeps them. The rules let almost
any redaction into the room; whether it applies to its target is a separate
test, run inside the same transaction as the redaction itself so that a
client holding an event ID can always read the stripped event.

storage: events keyed by event ID rather than by a surrogate, since an
event ID appears in prev_events, auth_events, state snapshots and client
requests alike. Stream ordering comes from a counter row bumped inside the
write transaction, because a PostgreSQL sequence is explicitly not
transactional and a rolled-back write would leave a hole in the stream that
/sync would have to be taught to skip. State snapshots are stored per event
and deduplicated by content hash, so the table grows with state changes
rather than with traffic — and that is what makes "the state after a
forward extremity" answerable at all. The room's listing columns are
denormalised onto its row because the public directory orders every
published room by member count and pages the result, which cannot be done
by reading each room's state in turn.

Federation-disabled behaviour from PLAN.md section 3 is enforced here.
Restricted joins are the exception that works: the rule needs a signature
from the authorising user's server verified, and while federation is off
that server is always this one.

adminapi: room list and detail, purge, force-leave, and room and event
counters on the dashboard. clientapi gains its own rate-limit buckets for
createRoom and for joining, both of which write events rather than read
them.

Tested against the real event core and a real database rather than fakes:
what is under test is whether an event this server signs is one the
authorisation rules accept, and a fake of either would only prove that the
pipeline calls what the fake expects. The storage tests run against both
SQL drivers. docs/rooms.md describes the pipeline, the storage decisions
and the known gaps — chief among them that history visibility is
room-level rather than per-event, and that /sync still reports no rooms,
both of which belong with the event stream in Phase 4.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-10-16 10:34:57 +02:00

531 lines
18 KiB
Go

package roomserver_test
import (
"encoding/json"
"errors"
"testing"
"github.com/dariuszjaniak/warp/server/internal/matrix/auth"
"github.com/dariuszjaniak/warp/server/internal/matrix/event"
"github.com/dariuszjaniak/warp/server/internal/roomserver"
)
func TestJoinPublicRoom(t *testing.T) {
f := newFixture(t, nil)
resp := f.createRoom(roomserver.CreateRoomRequest{Preset: roomserver.PresetPublicChat})
joined, err := f.api.JoinRoom(t.Context(), roomserver.JoinRequest{
RoomID: resp.RoomID,
User: bob,
})
if err != nil {
t.Fatalf("JoinRoom: %v", err)
}
if joined != resp.RoomID {
t.Errorf("JoinRoom returned %q, want %q", joined, resp.RoomID)
}
if got := f.membership(resp.RoomID, bob); got != event.MembershipJoin {
t.Errorf("bob's membership is %q, want join", got)
}
// A second join is a no-op, not a second event: clients call /join to
// make sure, and every extra membership event lands in everybody's
// timeline.
before, err := f.store.Event(t.Context(), resp.RoomID, f.memberEventID(resp.RoomID, bob))
if err != nil {
t.Fatalf("Event: %v", err)
}
if _, err := f.api.JoinRoom(t.Context(), roomserver.JoinRequest{
RoomID: resp.RoomID, User: bob,
}); err != nil {
t.Fatalf("joining twice: %v", err)
}
after, err := f.store.Event(t.Context(), resp.RoomID, f.memberEventID(resp.RoomID, bob))
if err != nil {
t.Fatalf("Event: %v", err)
}
if after.EventID != before.EventID {
t.Errorf("joining twice produced a second membership event")
}
// The joined-member count follows.
summary, err := f.store.RoomSummary(t.Context(), resp.RoomID)
if err != nil {
t.Fatalf("RoomSummary: %v", err)
}
if summary.JoinedMembers != 2 {
t.Errorf("the room has %d joined members, want 2", summary.JoinedMembers)
}
}
// memberEventID is the event ID of a user's current membership event.
func (f *fixture) memberEventID(roomID, userID string) string {
f.t.Helper()
entry, err := f.store.Membership(f.t.Context(), roomID, userID)
if err != nil {
f.t.Fatalf("Membership: %v", err)
}
return entry.EventID
}
func TestJoinInviteOnlyRoom(t *testing.T) {
f := newFixture(t, nil)
resp := f.createRoom(roomserver.CreateRoomRequest{Preset: roomserver.PresetPrivateChat})
// Without an invite the rules refuse the join. The refusal comes from
// them, not from a check in this package.
_, err := f.api.JoinRoom(t.Context(), roomserver.JoinRequest{
RoomID: resp.RoomID, User: bob,
})
if !errors.Is(err, roomserver.ErrRejected) {
t.Fatalf("joining an invite-only room = %v, want ErrRejected", err)
}
if err := f.api.InviteUser(t.Context(), roomserver.InviteRequest{
RoomID: resp.RoomID, Sender: alice, Target: bob,
}); err != nil {
t.Fatalf("InviteUser: %v", err)
}
if got := f.membership(resp.RoomID, bob); got != event.MembershipInvite {
t.Errorf("bob's membership after the invite is %q, want invite", got)
}
if _, err := f.api.JoinRoom(t.Context(), roomserver.JoinRequest{
RoomID: resp.RoomID, User: bob,
}); err != nil {
t.Fatalf("joining after an invite: %v", err)
}
if got := f.membership(resp.RoomID, bob); got != event.MembershipJoin {
t.Errorf("bob's membership after joining is %q, want join", got)
}
}
// TestInviteRequiresPower is the rule a room's moderators rely on.
func TestInviteRequiresPower(t *testing.T) {
f := newFixture(t, nil)
resp := f.createRoom(roomserver.CreateRoomRequest{Preset: roomserver.PresetPublicChat})
if _, err := f.api.JoinRoom(t.Context(), roomserver.JoinRequest{
RoomID: resp.RoomID, User: bob,
}); err != nil {
t.Fatalf("bob joining: %v", err)
}
// The default invite level is 0, so bob can invite. Raise it and he
// cannot.
if _, err := f.api.SendEvent(t.Context(), roomserver.SendEventRequest{
RoomID: resp.RoomID,
Sender: alice,
Type: event.TypePowerLevels,
StateKey: stringPtr(""),
Content: json.RawMessage(`{"invite":50,"users":{"` + alice + `":100}}`),
}); err != nil {
t.Fatalf("raising the invite level: %v", err)
}
err := f.api.InviteUser(t.Context(), roomserver.InviteRequest{
RoomID: resp.RoomID, Sender: bob, Target: carol,
})
if !errors.Is(err, roomserver.ErrRejected) {
t.Errorf("an invite without the power = %v, want ErrRejected", err)
}
}
func TestLeaveAndRejectInvite(t *testing.T) {
f := newFixture(t, nil)
resp := f.createRoom(roomserver.CreateRoomRequest{Preset: roomserver.PresetPublicChat})
if _, err := f.api.JoinRoom(t.Context(), roomserver.JoinRequest{
RoomID: resp.RoomID, User: bob,
}); err != nil {
t.Fatalf("bob joining: %v", err)
}
if err := f.api.LeaveRoom(t.Context(), resp.RoomID, bob, "bye"); err != nil {
t.Fatalf("LeaveRoom: %v", err)
}
if got := f.membership(resp.RoomID, bob); got != event.MembershipLeave {
t.Errorf("bob's membership after leaving is %q, want leave", got)
}
// The same endpoint rejects an invite, which is why it has to work on
// a room the caller was never joined to.
if err := f.api.InviteUser(t.Context(), roomserver.InviteRequest{
RoomID: resp.RoomID, Sender: alice, Target: carol,
}); err != nil {
t.Fatalf("InviteUser: %v", err)
}
if err := f.api.LeaveRoom(t.Context(), resp.RoomID, carol, "no thanks"); err != nil {
t.Fatalf("rejecting an invite: %v", err)
}
if got := f.membership(resp.RoomID, carol); got != event.MembershipLeave {
t.Errorf("carol's membership after rejecting is %q, want leave", got)
}
// Leaving a room you were never in is refused by the rules.
err := f.api.LeaveRoom(t.Context(), resp.RoomID, "@dave:"+testServerName, "")
if !errors.Is(err, roomserver.ErrRejected) {
t.Errorf("leaving a room never joined = %v, want ErrRejected", err)
}
}
func TestKickBanAndUnban(t *testing.T) {
f := newFixture(t, nil)
resp := f.createRoom(roomserver.CreateRoomRequest{Preset: roomserver.PresetPublicChat})
join := func(user string) {
t.Helper()
if _, err := f.api.JoinRoom(t.Context(), roomserver.JoinRequest{
RoomID: resp.RoomID, User: user,
}); err != nil {
t.Fatalf("%s joining: %v", user, err)
}
}
join(bob)
if err := f.api.KickUser(t.Context(), resp.RoomID, alice, bob, "behave"); err != nil {
t.Fatalf("KickUser: %v", err)
}
if got := f.membership(resp.RoomID, bob); got != event.MembershipLeave {
t.Errorf("bob's membership after the kick is %q, want leave", got)
}
// A kick is not a ban: bob can come back.
join(bob)
if err := f.api.BanUser(t.Context(), resp.RoomID, alice, bob, "enough"); err != nil {
t.Fatalf("BanUser: %v", err)
}
if got := f.membership(resp.RoomID, bob); got != event.MembershipBan {
t.Errorf("bob's membership after the ban is %q, want ban", got)
}
_, err := f.api.JoinRoom(t.Context(), roomserver.JoinRequest{
RoomID: resp.RoomID, User: bob,
})
if !errors.Is(err, roomserver.ErrRejected) {
t.Errorf("a banned user joining = %v, want ErrRejected", err)
}
if err := f.api.UnbanUser(t.Context(), resp.RoomID, alice, bob, ""); err != nil {
t.Fatalf("UnbanUser: %v", err)
}
// Unbanning leaves the user outside the room, not in it.
if got := f.membership(resp.RoomID, bob); got != event.MembershipLeave {
t.Errorf("bob's membership after the unban is %q, want leave", got)
}
join(bob)
// Unbanning somebody who is not banned says so rather than writing an
// event that means nothing.
err = f.api.UnbanUser(t.Context(), resp.RoomID, alice, bob, "")
if !errors.Is(err, roomserver.ErrForbidden) {
t.Errorf("unbanning a member = %v, want ErrForbidden", err)
}
}
// TestKickRequiresPower checks that a member cannot remove a peer.
func TestKickRequiresPower(t *testing.T) {
f := newFixture(t, nil)
resp := f.createRoom(roomserver.CreateRoomRequest{Preset: roomserver.PresetPublicChat})
for _, user := range []string{bob, carol} {
if _, err := f.api.JoinRoom(t.Context(), roomserver.JoinRequest{
RoomID: resp.RoomID, User: user,
}); err != nil {
t.Fatalf("%s joining: %v", user, err)
}
}
err := f.api.KickUser(t.Context(), resp.RoomID, bob, carol, "")
if !errors.Is(err, roomserver.ErrRejected) {
t.Errorf("a kick without the power = %v, want ErrRejected", err)
}
}
// TestMembershipRemoteUsersNeedFederation is the behaviour PLAN.md section 3
// asks for: a clear refusal rather than a bare M_FORBIDDEN.
func TestMembershipRemoteUsersNeedFederation(t *testing.T) {
f := newFixture(t, nil)
resp := f.createRoom(roomserver.CreateRoomRequest{})
err := f.api.InviteUser(t.Context(), roomserver.InviteRequest{
RoomID: resp.RoomID, Sender: alice, Target: "@eve:elsewhere.example",
})
if !errors.Is(err, roomserver.ErrFederationDisabled) {
t.Errorf("inviting a remote user = %v, want ErrFederationDisabled", err)
}
_, err = f.api.JoinRoom(t.Context(), roomserver.JoinRequest{
RoomID: "!elsewhere:elsewhere.example", User: alice,
})
if !errors.Is(err, roomserver.ErrFederationDisabled) {
t.Errorf("joining a remote room = %v, want ErrFederationDisabled", err)
}
// With federation on it is still not implemented, and says so — but it
// says it as a federation problem rather than as a missing room.
g := newFixture(t, func(opts *roomserver.Options) {
opts.FederationEnabled = func() bool { return true }
})
_, err = g.api.JoinRoom(t.Context(), roomserver.JoinRequest{
RoomID: "!elsewhere:elsewhere.example", User: alice,
})
if !errors.Is(err, roomserver.ErrFederationDisabled) {
t.Errorf("joining a remote room with federation on = %v, want ErrFederationDisabled", err)
}
}
// TestRestrictedJoin is the one authorisation rule that needs a signature
// checked, and so the one that needs this server to vouch for a join.
func TestRestrictedJoin(t *testing.T) {
f := newFixture(t, nil)
// The space whose membership grants entry.
space := f.createRoom(roomserver.CreateRoomRequest{Preset: roomserver.PresetPublicChat})
restricted := f.createRoom(roomserver.CreateRoomRequest{
Version: "11",
InitialState: []roomserver.StateEvent{{
Type: event.TypeJoinRules,
Content: json.RawMessage(`{"join_rule":"restricted","allow":[` +
`{"type":"m.room_membership","room_id":"` + space.RoomID + `"}]}`),
}},
})
// Not in the space: no entry.
_, err := f.api.JoinRoom(t.Context(), roomserver.JoinRequest{
RoomID: restricted.RoomID, User: bob,
})
if !errors.Is(err, roomserver.ErrForbidden) {
t.Fatalf("joining a restricted room from outside = %v, want ErrForbidden", err)
}
if _, err := f.api.JoinRoom(t.Context(), roomserver.JoinRequest{
RoomID: space.RoomID, User: bob,
}); err != nil {
t.Fatalf("bob joining the space: %v", err)
}
// In the space: the join is authorised via a local user with the power
// to invite, and the event carries their server's signature.
if _, err := f.api.JoinRoom(t.Context(), roomserver.JoinRequest{
RoomID: restricted.RoomID, User: bob,
}); err != nil {
t.Fatalf("joining a restricted room from the space: %v", err)
}
if got := f.membership(restricted.RoomID, bob); got != event.MembershipJoin {
t.Errorf("bob's membership is %q, want join", got)
}
st := f.state(restricted.RoomID)
member := st.Member(bob)
if member == nil {
t.Fatal("bob has no membership event")
}
var content struct {
AuthorisedVia string `json:"join_authorised_via_users_server"`
}
if err := json.Unmarshal(member.Content(), &content); err != nil {
t.Fatalf("the membership content is not an object: %v", err)
}
if content.AuthorisedVia != alice {
t.Errorf("join_authorised_via_users_server = %q, want %q", content.AuthorisedVia, alice)
}
}
func TestJoinedRoomsAndMembers(t *testing.T) {
f := newFixture(t, nil)
first := f.createRoom(roomserver.CreateRoomRequest{Preset: roomserver.PresetPublicChat})
second := f.createRoom(roomserver.CreateRoomRequest{Preset: roomserver.PresetPublicChat})
if _, err := f.api.JoinRoom(t.Context(), roomserver.JoinRequest{
RoomID: first.RoomID, User: bob,
}); err != nil {
t.Fatalf("bob joining: %v", err)
}
rooms, err := f.api.JoinedRooms(t.Context(), bob)
if err != nil {
t.Fatalf("JoinedRooms: %v", err)
}
if len(rooms) != 1 || rooms[0] != first.RoomID {
t.Errorf("bob's joined rooms = %v, want [%s]", rooms, first.RoomID)
}
aliceRooms, err := f.api.JoinedRooms(t.Context(), alice)
if err != nil {
t.Fatalf("JoinedRooms: %v", err)
}
if len(aliceRooms) != 2 {
t.Errorf("alice is joined to %v, want both rooms", aliceRooms)
}
joined, err := f.api.JoinedMembers(t.Context(), first.RoomID, alice)
if err != nil {
t.Fatalf("JoinedMembers: %v", err)
}
if len(joined) != 2 {
t.Fatalf("JoinedMembers returned %d members, want 2: %+v", len(joined), joined)
}
if joined[bob].DisplayName != "Bob" {
t.Errorf("bob's display name is %q, want Bob", joined[bob].DisplayName)
}
// /joined_members is for members: a stranger is refused.
if _, err := f.api.JoinedMembers(t.Context(), second.RoomID, bob); !errors.Is(err, roomserver.ErrForbidden) {
t.Errorf("JoinedMembers for a stranger = %v, want ErrForbidden", err)
}
// /members includes the users who have left, unless filtered.
if err := f.api.LeaveRoom(t.Context(), first.RoomID, bob, ""); err != nil {
t.Fatalf("LeaveRoom: %v", err)
}
all, err := f.api.Members(t.Context(), roomserver.MembersRequest{
RoomID: first.RoomID, User: alice,
})
if err != nil {
t.Fatalf("Members: %v", err)
}
if len(all) != 2 {
t.Errorf("Members returned %d events, want 2 (one of them a leave)", len(all))
}
onlyJoined, err := f.api.Members(t.Context(), roomserver.MembersRequest{
RoomID: first.RoomID, User: alice, Membership: event.MembershipJoin,
})
if err != nil {
t.Fatalf("Members with a filter: %v", err)
}
if len(onlyJoined) != 1 {
t.Errorf("filtering by join returned %d events, want 1", len(onlyJoined))
}
notJoined, err := f.api.Members(t.Context(), roomserver.MembersRequest{
RoomID: first.RoomID, User: alice, NotMembership: event.MembershipJoin,
})
if err != nil {
t.Fatalf("Members with not_membership: %v", err)
}
if len(notJoined) != 1 {
t.Errorf("not_membership=join returned %d events, want 1", len(notJoined))
}
}
// TestStateVisibility is the room-level visibility check the read endpoints
// make: a member sees the room, a stranger does not, and anyone sees a
// world-readable one.
func TestStateVisibility(t *testing.T) {
f := newFixture(t, nil)
private := f.createRoom(roomserver.CreateRoomRequest{})
if _, err := f.api.RoomState(t.Context(), private.RoomID, alice); err != nil {
t.Errorf("the creator cannot read their own room's state: %v", err)
}
if _, err := f.api.RoomState(t.Context(), private.RoomID, bob); !errors.Is(err, roomserver.ErrForbidden) {
t.Errorf("a stranger reading state = %v, want ErrForbidden", err)
}
readable := f.createRoom(roomserver.CreateRoomRequest{
InitialState: []roomserver.StateEvent{{
Type: event.TypeHistoryVisibility,
Content: json.RawMessage(`{"history_visibility":"world_readable"}`),
}},
})
if _, err := f.api.RoomState(t.Context(), readable.RoomID, bob); err != nil {
t.Errorf("a stranger cannot read a world-readable room's state: %v", err)
}
}
// TestForceLeave is the admin escape hatch: it adds a real membership
// event, so the room's other members see what happened.
func TestForceLeave(t *testing.T) {
f := newFixture(t, nil)
resp := f.createRoom(roomserver.CreateRoomRequest{Preset: roomserver.PresetPublicChat})
if _, err := f.api.JoinRoom(t.Context(), roomserver.JoinRequest{
RoomID: resp.RoomID, User: bob,
}); err != nil {
t.Fatalf("bob joining: %v", err)
}
if err := f.api.ForceLeave(t.Context(), resp.RoomID, bob); err != nil {
t.Fatalf("ForceLeave: %v", err)
}
if got := f.membership(resp.RoomID, bob); got != event.MembershipLeave {
t.Errorf("bob's membership is %q, want leave", got)
}
// A user who is not in the room has nothing to leave.
if err := f.api.ForceLeave(t.Context(), resp.RoomID, carol); !errors.Is(err, roomserver.ErrForbidden) {
t.Errorf("force-leaving a stranger = %v, want ErrForbidden", err)
}
}
// TestPowerLevelsCannotBeRaisedAboveYourOwn is the rule that keeps a
// moderator from promoting themselves.
func TestPowerLevelsCannotBeRaisedAboveYourOwn(t *testing.T) {
f := newFixture(t, nil)
resp := f.createRoom(roomserver.CreateRoomRequest{
Version: "11",
Preset: roomserver.PresetPublicChat,
PowerLevelContentOverride: json.RawMessage(
`{"users":{"` + alice + `":100,"` + bob + `":50}}`),
})
if _, err := f.api.JoinRoom(t.Context(), roomserver.JoinRequest{
RoomID: resp.RoomID, User: bob,
}); err != nil {
t.Fatalf("bob joining: %v", err)
}
_, err := f.api.SendEvent(t.Context(), roomserver.SendEventRequest{
RoomID: resp.RoomID,
Sender: bob,
Type: event.TypePowerLevels,
StateKey: stringPtr(""),
Content: json.RawMessage(`{"users":{"` + alice + `":100,"` + bob + `":100}}`),
})
if !errors.Is(err, roomserver.ErrRejected) {
t.Errorf("promoting yourself = %v, want ErrRejected", err)
}
st := f.state(resp.RoomID)
powerLevels, err := auth.ResolvePowerLevels(st.PowerLevels(), st.Create(), st.Create().Rules())
if err != nil {
t.Fatalf("ResolvePowerLevels: %v", err)
}
if got := powerLevels.UserLevel(bob); got != 50 {
t.Errorf("bob's power level is %d, want 50", got)
}
}
// TestKickRequiresTheTargetToBeInTheRoom keeps a kick from adding a leave
// event for somebody who was never there — which the authorisation rules
// would accept, and which every member of the room would then see.
func TestKickRequiresTheTargetToBeInTheRoom(t *testing.T) {
f := newFixture(t, nil)
resp := f.createRoom(roomserver.CreateRoomRequest{Preset: roomserver.PresetPublicChat})
err := f.api.KickUser(t.Context(), resp.RoomID, alice, bob, "")
if !errors.Is(err, roomserver.ErrForbidden) {
t.Errorf("kicking a stranger = %v, want ErrForbidden", err)
}
// An invite can be withdrawn with a kick, which is what the endpoint
// is for as much as removing a member is.
if err := f.api.InviteUser(t.Context(), roomserver.InviteRequest{
RoomID: resp.RoomID, Sender: alice, Target: bob,
}); err != nil {
t.Fatalf("InviteUser: %v", err)
}
if err := f.api.KickUser(t.Context(), resp.RoomID, alice, bob, ""); err != nil {
t.Fatalf("withdrawing an invite with a kick: %v", err)
}
if got := f.membership(resp.RoomID, bob); got != event.MembershipLeave {
t.Errorf("bob's membership is %q, want leave", got)
}
// Lifting a ban is /unban, not a kick.
if err := f.api.BanUser(t.Context(), resp.RoomID, alice, bob, ""); err != nil {
t.Fatalf("BanUser: %v", err)
}
if err := f.api.KickUser(t.Context(), resp.RoomID, alice, bob, ""); !errors.Is(err, roomserver.ErrForbidden) {
t.Errorf("kicking a banned user = %v, want ErrForbidden", err)
}
}