Add get_state method to test RestHelper
parent
9c8582dffe
commit
2facfc534c
tests/rest/client/v1
|
@ -142,7 +142,7 @@ class RestHelper(object):
|
|||
|
||||
return channel.json_body
|
||||
|
||||
def send_state(self, room_id, event_type, body, tok, expect_code=200, state_key=""):
|
||||
def _read_write_state(self, room_id, event_type, body, tok, expect_code=200, state_key="", method="GET"):
|
||||
path = "/_matrix/client/r0/rooms/%s/state/%s/%s" % (
|
||||
room_id,
|
||||
event_type,
|
||||
|
@ -152,7 +152,7 @@ class RestHelper(object):
|
|||
path = path + "?access_token=%s" % tok
|
||||
|
||||
request, channel = make_request(
|
||||
self.hs.get_reactor(), "PUT", path, json.dumps(body).encode("utf8")
|
||||
self.hs.get_reactor(), method, path, json.dumps(body).encode("utf8")
|
||||
)
|
||||
render(request, self.resource, self.hs.get_reactor())
|
||||
|
||||
|
@ -163,6 +163,12 @@ class RestHelper(object):
|
|||
|
||||
return channel.json_body
|
||||
|
||||
def get_state(self, room_id, event_type, tok, expect_code=200, state_key=""):
|
||||
return self._read_write_state(room_id, event_type, {}, tok, expect_code, state_key, method="GET")
|
||||
|
||||
def send_state(self, room_id, event_type, body, tok, expect_code=200, state_key=""):
|
||||
return self._read_write_state(room_id, event_type, body, tok, expect_code, state_key, method="PUT")
|
||||
|
||||
def upload_media(
|
||||
self,
|
||||
resource: Resource,
|
||||
|
|
Loading…
Reference in New Issue