Fix the tests to include new db calls

This commit is contained in:
Erik Johnston 2014-09-01 19:57:17 +01:00
parent b8ab9f1c0a
commit 3f5ebccbff
2 changed files with 20 additions and 6 deletions

View File

@ -330,6 +330,8 @@ class RoomCreationTest(unittest.TestCase):
datastore=NonCallableMock(spec_set=[ datastore=NonCallableMock(spec_set=[
"store_room", "store_room",
"snapshot_room", "snapshot_room",
"persist_event",
"get_joined_hosts_for_room",
]), ]),
http_client=NonCallableMock(spec_set=[]), http_client=NonCallableMock(spec_set=[]),
notifier=NonCallableMock(spec_set=["on_new_room_event"]), notifier=NonCallableMock(spec_set=["on_new_room_event"]),
@ -362,6 +364,10 @@ class RoomCreationTest(unittest.TestCase):
]) ])
self.room_member_handler = self.handlers.room_member_handler self.room_member_handler = self.handlers.room_member_handler
def hosts(room):
return defer.succeed([])
self.datastore.get_joined_hosts_for_room.side_effect = hosts
@defer.inlineCallbacks @defer.inlineCallbacks
def test_room_creation(self): def test_room_creation(self):
user_id = "@foo:red" user_id = "@foo:red"
@ -385,9 +391,3 @@ class RoomCreationTest(unittest.TestCase):
self.assertTrue(self.state_handler.handle_new_event.called) self.assertTrue(self.state_handler.handle_new_event.called)
self.assertTrue(self.federation.handle_new_event.called) self.assertTrue(self.federation.handle_new_event.called)
config_event = self.federation.handle_new_event.call_args[0][0]
self.assertEquals(RoomConfigEvent.TYPE, config_event.type)
self.assertEquals(room_id, config_event.room_id)
self.assertEquals(user_id, config_event.user_id)
self.assertEquals(config, config_event.content)

View File

@ -234,6 +234,20 @@ class MemoryDataStore(object):
def get_room_events_max_id(self): def get_room_events_max_id(self):
return 0 # TODO (erikj) return 0 # TODO (erikj)
def get_send_event_level(self, room_id):
return defer.succeed(0)
def get_power_level(self, room_id, user_id):
return defer.succeed(0)
def get_add_state_level(self, room_id):
return defer.succeed(0)
def get_room_join_rule(self, room_id):
# TODO (erikj): This should be configurable
return defer.succeed("invite")
def _format_call(args, kwargs): def _format_call(args, kwargs):
return ", ".join( return ", ".join(
["%r" % (a) for a in args] + ["%r" % (a) for a in args] +