Add knock information in admin exported data (#11171)

Signed-off-by: Rafael Goncalves <rafaelgoncalves@riseup.net>
This commit is contained in:
Rafael Gonçalves 2021-10-28 14:54:38 -03:00 committed by GitHub
parent e002faee01
commit 0e16b418f6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 99 additions and 2 deletions

View file

@ -120,6 +120,35 @@ class RestHelper:
expect_code=expect_code,
)
def knock(self, room=None, user=None, reason=None, expect_code=200, tok=None):
temp_id = self.auth_user_id
self.auth_user_id = user
path = "/knock/%s" % room
if tok:
path = path + "?access_token=%s" % tok
data = {}
if reason:
data["reason"] = reason
channel = make_request(
self.hs.get_reactor(),
self.site,
"POST",
path,
json.dumps(data).encode("utf8"),
)
assert (
int(channel.result["code"]) == expect_code
), "Expected: %d, got: %d, resp: %r" % (
expect_code,
int(channel.result["code"]),
channel.result["body"],
)
self.auth_user_id = temp_id
def leave(self, room=None, user=None, expect_code=200, tok=None):
self.change_membership(
room=room,