diff options
author | Richard van der Hoff <richard@matrix.org> | 2016-07-26 16:46:53 +0100 |
---|---|---|
committer | Richard van der Hoff <richard@matrix.org> | 2016-07-26 16:46:53 +0100 |
commit | eb359eced44407b1ee9648f10fdf3df63c8d40ad (patch) | |
tree | d2067b5f2fbfcc69f7303c3fa567082a5d9469b6 /tests/replication | |
parent | Fix typo (diff) | |
download | synapse-eb359eced44407b1ee9648f10fdf3df63c8d40ad.tar.xz |
Add `create_requester` function
Wrap the `Requester` constructor with a function which provides sensible defaults, and use it throughout
Diffstat (limited to '')
-rw-r--r-- | tests/replication/test_resource.py | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/tests/replication/test_resource.py b/tests/replication/test_resource.py index 842e3d29d7..e70ac6f14d 100644 --- a/tests/replication/test_resource.py +++ b/tests/replication/test_resource.py @@ -13,15 +13,17 @@ # See the License for the specific language governing permissions and # limitations under the License. -from synapse.replication.resource import ReplicationResource -from synapse.types import Requester, UserID +import contextlib +import json +from mock import Mock, NonCallableMock from twisted.internet import defer + +import synapse.types +from synapse.replication.resource import ReplicationResource +from synapse.types import UserID from tests import unittest -from tests.utils import setup_test_homeserver, requester_for_user -from mock import Mock, NonCallableMock -import json -import contextlib +from tests.utils import setup_test_homeserver class ReplicationResourceCase(unittest.TestCase): @@ -61,7 +63,7 @@ class ReplicationResourceCase(unittest.TestCase): def test_events_and_state(self): get = self.get(events="-1", state="-1", timeout="0") yield self.hs.get_handlers().room_creation_handler.create_room( - Requester(self.user, "", False), {} + synapse.types.create_requester(self.user), {} ) code, body = yield get self.assertEquals(code, 200) @@ -144,7 +146,7 @@ class ReplicationResourceCase(unittest.TestCase): def send_text_message(self, room_id, message): handler = self.hs.get_handlers().message_handler event = yield handler.create_and_send_nonmember_event( - requester_for_user(self.user), + synapse.types.create_requester(self.user), { "type": "m.room.message", "content": {"body": "message", "msgtype": "m.text"}, @@ -157,7 +159,7 @@ class ReplicationResourceCase(unittest.TestCase): @defer.inlineCallbacks def create_room(self): result = yield self.hs.get_handlers().room_creation_handler.create_room( - Requester(self.user, "", False), {} + synapse.types.create_requester(self.user), {} ) defer.returnValue(result["room_id"]) |