Add mocks to make tests work again
This commit is contained in:
parent
9b4cd0cd0f
commit
d79e90f078
|
@ -49,6 +49,10 @@ class FederationTestCase(unittest.TestCase):
|
||||||
"get_destination_retry_timings",
|
"get_destination_retry_timings",
|
||||||
"set_destination_retry_timings",
|
"set_destination_retry_timings",
|
||||||
"have_events",
|
"have_events",
|
||||||
|
"get_users_in_room",
|
||||||
|
"bulk_get_push_rules",
|
||||||
|
"get_current_state",
|
||||||
|
"set_actions_for_event_and_users",
|
||||||
]),
|
]),
|
||||||
resource_for_federation=NonCallableMock(),
|
resource_for_federation=NonCallableMock(),
|
||||||
http_client=NonCallableMock(spec_set=[]),
|
http_client=NonCallableMock(spec_set=[]),
|
||||||
|
@ -85,6 +89,9 @@ class FederationTestCase(unittest.TestCase):
|
||||||
|
|
||||||
self.datastore.persist_event.return_value = defer.succeed((1,1))
|
self.datastore.persist_event.return_value = defer.succeed((1,1))
|
||||||
self.datastore.get_room.return_value = defer.succeed(True)
|
self.datastore.get_room.return_value = defer.succeed(True)
|
||||||
|
self.datastore.get_users_in_room.return_value = ["@a:b"]
|
||||||
|
self.datastore.bulk_get_push_rules.return_value = {}
|
||||||
|
self.datastore.get_current_state.return_value = {}
|
||||||
self.auth.check_host_in_room.return_value = defer.succeed(True)
|
self.auth.check_host_in_room.return_value = defer.succeed(True)
|
||||||
|
|
||||||
retry_timings_res = {
|
retry_timings_res = {
|
||||||
|
|
|
@ -43,6 +43,10 @@ class RoomMemberHandlerTestCase(unittest.TestCase):
|
||||||
"store_room",
|
"store_room",
|
||||||
"get_latest_events_in_room",
|
"get_latest_events_in_room",
|
||||||
"add_event_hashes",
|
"add_event_hashes",
|
||||||
|
"get_users_in_room",
|
||||||
|
"bulk_get_push_rules",
|
||||||
|
"get_current_state",
|
||||||
|
"set_actions_for_event_and_users",
|
||||||
]),
|
]),
|
||||||
resource_for_federation=NonCallableMock(),
|
resource_for_federation=NonCallableMock(),
|
||||||
http_client=NonCallableMock(spec_set=[]),
|
http_client=NonCallableMock(spec_set=[]),
|
||||||
|
@ -90,6 +94,8 @@ class RoomMemberHandlerTestCase(unittest.TestCase):
|
||||||
|
|
||||||
self.datastore.persist_event.return_value = (1,1)
|
self.datastore.persist_event.return_value = (1,1)
|
||||||
self.datastore.add_event_hashes.return_value = []
|
self.datastore.add_event_hashes.return_value = []
|
||||||
|
self.datastore.get_users_in_room.return_value = ["@bob:red"]
|
||||||
|
self.datastore.bulk_get_push_rules.return_value = {}
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def test_invite(self):
|
def test_invite(self):
|
||||||
|
@ -109,6 +115,7 @@ class RoomMemberHandlerTestCase(unittest.TestCase):
|
||||||
self.datastore.get_latest_events_in_room.return_value = (
|
self.datastore.get_latest_events_in_room.return_value = (
|
||||||
defer.succeed([])
|
defer.succeed([])
|
||||||
)
|
)
|
||||||
|
self.datastore.get_current_state.return_value = {}
|
||||||
|
|
||||||
def annotate(_):
|
def annotate(_):
|
||||||
ctx = Mock()
|
ctx = Mock()
|
||||||
|
@ -190,6 +197,7 @@ class RoomMemberHandlerTestCase(unittest.TestCase):
|
||||||
self.datastore.get_latest_events_in_room.return_value = (
|
self.datastore.get_latest_events_in_room.return_value = (
|
||||||
defer.succeed([])
|
defer.succeed([])
|
||||||
)
|
)
|
||||||
|
self.datastore.get_current_state.return_value = {}
|
||||||
|
|
||||||
def annotate(_):
|
def annotate(_):
|
||||||
ctx = Mock()
|
ctx = Mock()
|
||||||
|
@ -265,6 +273,7 @@ class RoomMemberHandlerTestCase(unittest.TestCase):
|
||||||
self.datastore.get_latest_events_in_room.return_value = (
|
self.datastore.get_latest_events_in_room.return_value = (
|
||||||
defer.succeed([])
|
defer.succeed([])
|
||||||
)
|
)
|
||||||
|
self.datastore.get_current_state.return_value = {}
|
||||||
|
|
||||||
def annotate(_):
|
def annotate(_):
|
||||||
ctx = Mock()
|
ctx = Mock()
|
||||||
|
|
Loading…
Reference in New Issue