diff options
author | Brendan Abolivier <babolivier@matrix.org> | 2019-10-30 16:47:37 +0000 |
---|---|---|
committer | Brendan Abolivier <babolivier@matrix.org> | 2019-10-30 16:47:37 +0000 |
commit | 395683add1d569c0fdfd83d279551a3ba926f4d5 (patch) | |
tree | 0674c91c502f6422383c329b726f2bb81ef3544a /tests/rest/client/v1 | |
parent | Add unit tests (diff) | |
download | synapse-395683add1d569c0fdfd83d279551a3ba926f4d5.tar.xz |
Add integration tests for sync
Diffstat (limited to 'tests/rest/client/v1')
-rw-r--r-- | tests/rest/client/v1/utils.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tests/rest/client/v1/utils.py b/tests/rest/client/v1/utils.py index cdded88b7f..8ea0cb05ea 100644 --- a/tests/rest/client/v1/utils.py +++ b/tests/rest/client/v1/utils.py @@ -106,13 +106,22 @@ class RestHelper(object): self.auth_user_id = temp_id def send(self, room_id, body=None, txn_id=None, tok=None, expect_code=200): - if txn_id is None: - txn_id = "m%s" % (str(time.time())) if body is None: body = "body_text_here" - path = "/_matrix/client/r0/rooms/%s/send/m.room.message/%s" % (room_id, txn_id) content = {"msgtype": "m.text", "body": body} + + return self.send_event( + room_id, "m.room.message", content, txn_id, tok, expect_code + ) + + def send_event( + self, room_id, type, content={}, txn_id=None, tok=None, expect_code=200 + ): + if txn_id is None: + txn_id = "m%s" % (str(time.time())) + + path = "/_matrix/client/r0/rooms/%s/send/%s/%s" % (room_id, type, txn_id) if tok: path = path + "?access_token=%s" % tok |