summary refs log tree commit diff
path: root/tests/rest/client/utils.py
diff options
context:
space:
mode:
authorAaron Raimist <aaron@raim.ist>2021-09-21 05:23:34 -0500
committerGitHub <noreply@github.com>2021-09-21 10:23:34 +0000
commit6a751ff5e064bbb1fae2915e533031531c9d74e7 (patch)
tree45e5a9fe2b31d056809156dc60b15196a603bd3a /tests/rest/client/utils.py
parentGHA: reintroduce an env var for `$GITHUB_HEAD_REF` (#10659) (diff)
downloadsynapse-6a751ff5e064bbb1fae2915e533031531c9d74e7.tar.xz
Allow sending a membership event to unban a user (#10807)
* Allow membership event to unban user

Signed-off-by: Aaron Raimist <aaron@raim.ist>
Diffstat (limited to '')
-rw-r--r--tests/rest/client/utils.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/rest/client/utils.py b/tests/rest/client/utils.py
index 954ad1a1fd..c56e45fc10 100644
--- a/tests/rest/client/utils.py
+++ b/tests/rest/client/utils.py
@@ -138,6 +138,7 @@ class RestHelper:
         extra_data: Optional[dict] = None,
         tok: Optional[str] = None,
         expect_code: int = 200,
+        expect_errcode: str = None,
     ) -> None:
         """
         Send a membership state event into a room.
@@ -150,6 +151,7 @@ class RestHelper:
             extra_data: Extra information to include in the content of the event
             tok: The user access token to use
             expect_code: The expected HTTP response code
+            expect_errcode: The expected Matrix error code
         """
         temp_id = self.auth_user_id
         self.auth_user_id = src
@@ -177,6 +179,15 @@ class RestHelper:
             channel.result["body"],
         )
 
+        if expect_errcode:
+            assert (
+                str(channel.json_body["errcode"]) == expect_errcode
+            ), "Expected: %r, got: %r, resp: %r" % (
+                expect_errcode,
+                channel.json_body["errcode"],
+                channel.result["body"],
+            )
+
         self.auth_user_id = temp_id
 
     def send(