Fix tests

This commit is contained in:
David Baker 2015-03-24 18:56:51 +00:00
parent 438a21c87b
commit ce2766d19c
5 changed files with 14 additions and 14 deletions

View file

@ -75,7 +75,7 @@ class PresenceStateTestCase(unittest.TestCase):
"token_id": 1,
}
hs.get_auth().get_user_by_token = _get_user_by_token
hs.get_v1auth().get_user_by_token = _get_user_by_token
room_member_handler = hs.handlers.room_member_handler = Mock(
spec=[
@ -170,7 +170,7 @@ class PresenceListTestCase(unittest.TestCase):
]
)
hs.get_auth().get_user_by_token = _get_user_by_token
hs.get_v1auth().get_user_by_token = _get_user_by_token
presence.register_servlets(hs, self.mock_resource)
@ -277,7 +277,7 @@ class PresenceEventStreamTestCase(unittest.TestCase):
def _get_user_by_req(req=None):
return (UserID.from_string(myid), "")
hs.get_auth().get_user_by_req = _get_user_by_req
hs.get_v1auth().get_user_by_req = _get_user_by_req
presence.register_servlets(hs, self.mock_resource)
events.register_servlets(hs, self.mock_resource)

View file

@ -55,7 +55,7 @@ class ProfileTestCase(unittest.TestCase):
def _get_user_by_req(request=None):
return (UserID.from_string(myid), "")
hs.get_auth().get_user_by_req = _get_user_by_req
hs.get_v1auth().get_user_by_req = _get_user_by_req
hs.get_handlers().profile_handler = self.mock_handler

View file

@ -61,7 +61,7 @@ class RoomPermissionsTestCase(RestTestCase):
"device_id": None,
"token_id": 1,
}
hs.get_auth().get_user_by_token = _get_user_by_token
hs.get_v1auth().get_user_by_token = _get_user_by_token
def _insert_client_ip(*args, **kwargs):
return defer.succeed(None)
@ -71,7 +71,7 @@ class RoomPermissionsTestCase(RestTestCase):
synapse.rest.client.v1.room.register_servlets(hs, self.mock_resource)
self.auth = hs.get_auth()
self.auth = hs.get_v1auth()
# create some rooms under the name rmcreator_id
self.uncreated_rmid = "!aa:test"
@ -448,7 +448,7 @@ class RoomsMemberListTestCase(RestTestCase):
"device_id": None,
"token_id": 1,
}
hs.get_auth().get_user_by_token = _get_user_by_token
hs.get_v1auth().get_user_by_token = _get_user_by_token
def _insert_client_ip(*args, **kwargs):
return defer.succeed(None)
@ -528,7 +528,7 @@ class RoomsCreateTestCase(RestTestCase):
"device_id": None,
"token_id": 1,
}
hs.get_auth().get_user_by_token = _get_user_by_token
hs.get_v1auth().get_user_by_token = _get_user_by_token
def _insert_client_ip(*args, **kwargs):
return defer.succeed(None)
@ -622,7 +622,7 @@ class RoomTopicTestCase(RestTestCase):
"token_id": 1,
}
hs.get_auth().get_user_by_token = _get_user_by_token
hs.get_v1auth().get_user_by_token = _get_user_by_token
def _insert_client_ip(*args, **kwargs):
return defer.succeed(None)
@ -728,7 +728,7 @@ class RoomMemberStateTestCase(RestTestCase):
"device_id": None,
"token_id": 1,
}
hs.get_auth().get_user_by_token = _get_user_by_token
hs.get_v1auth().get_user_by_token = _get_user_by_token
def _insert_client_ip(*args, **kwargs):
return defer.succeed(None)
@ -855,7 +855,7 @@ class RoomMessagesTestCase(RestTestCase):
"device_id": None,
"token_id": 1,
}
hs.get_auth().get_user_by_token = _get_user_by_token
hs.get_v1auth().get_user_by_token = _get_user_by_token
def _insert_client_ip(*args, **kwargs):
return defer.succeed(None)
@ -952,7 +952,7 @@ class RoomInitialSyncTestCase(RestTestCase):
"device_id": None,
"token_id": 1,
}
hs.get_auth().get_user_by_token = _get_user_by_token
hs.get_v1auth().get_user_by_token = _get_user_by_token
def _insert_client_ip(*args, **kwargs):
return defer.succeed(None)

View file

@ -67,7 +67,7 @@ class RoomTypingTestCase(RestTestCase):
"token_id": 1,
}
hs.get_auth().get_user_by_token = _get_user_by_token
hs.get_v1auth().get_user_by_token = _get_user_by_token
def _insert_client_ip(*args, **kwargs):
return defer.succeed(None)

View file

@ -38,7 +38,7 @@ class RegistrationStoreTestCase(unittest.TestCase):
@defer.inlineCallbacks
def test_register(self):
yield self.store.register(self.user_id, self.tokens[0], self.pwhash)
u = yield self.store.get_user_by_id(self.user_id)[0]
u = (yield self.store.get_user_by_id(self.user_id))[0]
# TODO(paul): Surely this field should be 'user_id', not 'name'
# Additionally surely it shouldn't come in a 1-element list