Allow sending a membership event to unban a user (#10807)

* Allow membership event to unban user

Signed-off-by: Aaron Raimist <aaron@raim.ist>
This commit is contained in:
Aaron Raimist 2021-09-21 05:23:34 -05:00 committed by GitHub
parent f455b0e420
commit 6a751ff5e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 99 additions and 2 deletions

View file

@ -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(