aboutsummaryrefslogtreecommitdiff
path: root/roomserver/roomserver_test.go
diff options
context:
space:
mode:
authorTill <2353100+S7evinK@users.noreply.github.com>2023-04-28 17:46:01 +0200
committerGitHub <noreply@github.com>2023-04-28 17:46:01 +0200
commit6b47cf0f6ac9176b7e5a5bd6f357722ee0f5e384 (patch)
tree484c0133034ec1968e66d69b58c4f90486b1c5ae /roomserver/roomserver_test.go
parent1432743d1ad669718e8f70f4dc1f29a9762e3fc4 (diff)
Remove `PerformError` (#3066)
This removes `PerformError`, which was needed when we still had polylith. This removes quite a bunch of ```go if err != nil { return err } if err := res.Error; err != nil { return err.JSONResponse() } ``` Hopefully can be read commit by commit. [skip ci]
Diffstat (limited to 'roomserver/roomserver_test.go')
-rw-r--r--roomserver/roomserver_test.go27
1 files changed, 8 insertions, 19 deletions
diff --git a/roomserver/roomserver_test.go b/roomserver/roomserver_test.go
index 856321bc..9877dd91 100644
--- a/roomserver/roomserver_test.go
+++ b/roomserver/roomserver_test.go
@@ -254,13 +254,9 @@ func TestPurgeRoom(t *testing.T) {
}
// some dummy entries to validate after purging
- publishResp := &api.PerformPublishResponse{}
- if err = rsAPI.PerformPublish(ctx, &api.PerformPublishRequest{RoomID: room.ID, Visibility: "public"}, publishResp); err != nil {
+ if err = rsAPI.PerformPublish(ctx, &api.PerformPublishRequest{RoomID: room.ID, Visibility: spec.Public}); err != nil {
t.Fatal(err)
}
- if publishResp.Error != nil {
- t.Fatal(publishResp.Error)
- }
isPublished, err := db.GetPublishedRoom(ctx, room.ID)
if err != nil {
@@ -328,8 +324,7 @@ func TestPurgeRoom(t *testing.T) {
}
// purge the room from the database
- purgeResp := &api.PerformAdminPurgeRoomResponse{}
- if err = rsAPI.PerformAdminPurgeRoom(ctx, &api.PerformAdminPurgeRoomRequest{RoomID: room.ID}, purgeResp); err != nil {
+ if err = rsAPI.PerformAdminPurgeRoom(ctx, room.ID); err != nil {
t.Fatal(err)
}
@@ -926,7 +921,7 @@ func TestUpgrade(t *testing.T) {
if err := rsAPI.PerformPublish(ctx, &api.PerformPublishRequest{
RoomID: r.ID,
Visibility: spec.Public,
- }, &api.PerformPublishResponse{}); err != nil {
+ }); err != nil {
t.Fatal(err)
}
@@ -1070,25 +1065,19 @@ func TestUpgrade(t *testing.T) {
}
roomID := tc.roomFunc(rsAPI)
- upgradeReq := api.PerformRoomUpgradeRequest{
- RoomID: roomID,
- UserID: tc.upgradeUser,
- RoomVersion: version.DefaultRoomVersion(), // always upgrade to the latest version
- }
- upgradeRes := api.PerformRoomUpgradeResponse{}
-
- if err := rsAPI.PerformRoomUpgrade(processCtx.Context(), &upgradeReq, &upgradeRes); err != nil {
+ newRoomID, err := rsAPI.PerformRoomUpgrade(processCtx.Context(), roomID, tc.upgradeUser, version.DefaultRoomVersion())
+ if err != nil && tc.wantNewRoom {
t.Fatal(err)
}
- if tc.wantNewRoom && upgradeRes.NewRoomID == "" {
+ if tc.wantNewRoom && newRoomID == "" {
t.Fatalf("expected a new room, but the upgrade failed")
}
- if !tc.wantNewRoom && upgradeRes.NewRoomID != "" {
+ if !tc.wantNewRoom && newRoomID != "" {
t.Fatalf("expected no new room, but the upgrade succeeded")
}
if tc.validateFunc != nil {
- tc.validateFunc(t, roomID, upgradeRes.NewRoomID, rsAPI)
+ tc.validateFunc(t, roomID, newRoomID, rsAPI)
}
})
}