summary refs log tree commit diff
path: root/tests/rest/client/utils.py
diff options
context:
space:
mode:
authorOlivier Wilkinson (reivilibre) <oliverw@matrix.org>2021-11-09 11:58:35 +0000
committerOlivier Wilkinson (reivilibre) <oliverw@matrix.org>2021-11-09 11:58:35 +0000
commit9d3b04e7495e147829a09c56a9e5762467d18b78 (patch)
tree39cd3fadcbc3e3be8c89777099724643730c5df1 /tests/rest/client/utils.py
parentMerge remote-tracking branch 'origin/release-v1.46' into matrix-org-hotfixes (diff)
parentInclude cross-signing signatures when syncing remote devices for the first ti... (diff)
downloadsynapse-9d3b04e7495e147829a09c56a9e5762467d18b78.tar.xz
Merge branch 'release-v1.47' into matrix-org-hotfixes
Diffstat (limited to 'tests/rest/client/utils.py')
-rw-r--r--tests/rest/client/utils.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/rest/client/utils.py b/tests/rest/client/utils.py

index 71fa87ce92..ec0979850b 100644 --- a/tests/rest/client/utils.py +++ b/tests/rest/client/utils.py
@@ -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,