Room Statistics (#4338)

This commit is contained in:
Amber Brown 2019-05-21 11:36:50 -05:00 committed by GitHub
parent f4c80d70f8
commit 4a30e4acb4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 1306 additions and 13 deletions

View file

@ -127,3 +127,20 @@ class RestHelper(object):
)
return channel.json_body
def send_state(self, room_id, event_type, body, tok, expect_code=200):
path = "/_matrix/client/r0/rooms/%s/state/%s" % (room_id, event_type)
if tok:
path = path + "?access_token=%s" % tok
request, channel = make_request(
self.hs.get_reactor(), "PUT", path, json.dumps(body).encode('utf8')
)
render(request, self.resource, self.hs.get_reactor())
assert int(channel.result["code"]) == expect_code, (
"Expected: %d, got: %d, resp: %r"
% (expect_code, int(channel.result["code"]), channel.result["body"])
)
return channel.json_body