mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2024-10-01 11:49:51 -04:00
fix UTs by telling all the mock stores about the new methods for tracking retries
This commit is contained in:
parent
c46ce4fca2
commit
8ada2d2018
@ -25,6 +25,7 @@ from synapse.server import HomeServer
|
|||||||
from synapse.federation import initialize_http_replication
|
from synapse.federation import initialize_http_replication
|
||||||
from synapse.api.events import SynapseEvent
|
from synapse.api.events import SynapseEvent
|
||||||
|
|
||||||
|
from synapse.storage.transactions import DestinationsTable
|
||||||
|
|
||||||
def make_pdu(prev_pdus=[], **kwargs):
|
def make_pdu(prev_pdus=[], **kwargs):
|
||||||
"""Provide some default fields for making a PduTuple."""
|
"""Provide some default fields for making a PduTuple."""
|
||||||
@ -55,10 +56,14 @@ class FederationTestCase(unittest.TestCase):
|
|||||||
"delivered_txn",
|
"delivered_txn",
|
||||||
"get_received_txn_response",
|
"get_received_txn_response",
|
||||||
"set_received_txn_response",
|
"set_received_txn_response",
|
||||||
|
"get_destination_retry_timings",
|
||||||
])
|
])
|
||||||
self.mock_persistence.get_received_txn_response.return_value = (
|
self.mock_persistence.get_received_txn_response.return_value = (
|
||||||
defer.succeed(None)
|
defer.succeed(None)
|
||||||
)
|
)
|
||||||
|
self.mock_persistence.get_destination_retry_timings.return_value = (
|
||||||
|
defer.succeed(DestinationsTable.EntryType("", 0, 0))
|
||||||
|
)
|
||||||
self.mock_config = Mock()
|
self.mock_config = Mock()
|
||||||
self.mock_config.signing_key = [MockKey()]
|
self.mock_config.signing_key = [MockKey()]
|
||||||
self.clock = MockClock()
|
self.clock = MockClock()
|
||||||
|
@ -53,6 +53,8 @@ class FederationTestCase(unittest.TestCase):
|
|||||||
"persist_event",
|
"persist_event",
|
||||||
"store_room",
|
"store_room",
|
||||||
"get_room",
|
"get_room",
|
||||||
|
"get_destination_retry_timings",
|
||||||
|
"set_destination_retry_timings",
|
||||||
]),
|
]),
|
||||||
resource_for_federation=NonCallableMock(),
|
resource_for_federation=NonCallableMock(),
|
||||||
http_client=NonCallableMock(spec_set=[]),
|
http_client=NonCallableMock(spec_set=[]),
|
||||||
|
@ -30,7 +30,7 @@ from synapse.api.constants import PresenceState
|
|||||||
from synapse.api.errors import SynapseError
|
from synapse.api.errors import SynapseError
|
||||||
from synapse.handlers.presence import PresenceHandler, UserPresenceCache
|
from synapse.handlers.presence import PresenceHandler, UserPresenceCache
|
||||||
from synapse.streams.config import SourcePaginationConfig
|
from synapse.streams.config import SourcePaginationConfig
|
||||||
|
from synapse.storage.transactions import DestinationsTable
|
||||||
|
|
||||||
OFFLINE = PresenceState.OFFLINE
|
OFFLINE = PresenceState.OFFLINE
|
||||||
UNAVAILABLE = PresenceState.UNAVAILABLE
|
UNAVAILABLE = PresenceState.UNAVAILABLE
|
||||||
@ -528,6 +528,7 @@ class PresencePushTestCase(unittest.TestCase):
|
|||||||
"delivered_txn",
|
"delivered_txn",
|
||||||
"get_received_txn_response",
|
"get_received_txn_response",
|
||||||
"set_received_txn_response",
|
"set_received_txn_response",
|
||||||
|
"get_destination_retry_timings",
|
||||||
]),
|
]),
|
||||||
handlers=None,
|
handlers=None,
|
||||||
resource_for_client=Mock(),
|
resource_for_client=Mock(),
|
||||||
@ -539,6 +540,9 @@ class PresencePushTestCase(unittest.TestCase):
|
|||||||
hs.handlers = JustPresenceHandlers(hs)
|
hs.handlers = JustPresenceHandlers(hs)
|
||||||
|
|
||||||
self.datastore = hs.get_datastore()
|
self.datastore = hs.get_datastore()
|
||||||
|
self.datastore.get_destination_retry_timings.return_value = (
|
||||||
|
defer.succeed(DestinationsTable.EntryType("", 0, 0))
|
||||||
|
)
|
||||||
|
|
||||||
def get_received_txn_response(*args):
|
def get_received_txn_response(*args):
|
||||||
return defer.succeed(None)
|
return defer.succeed(None)
|
||||||
@ -1037,6 +1041,7 @@ class PresencePollingTestCase(unittest.TestCase):
|
|||||||
"delivered_txn",
|
"delivered_txn",
|
||||||
"get_received_txn_response",
|
"get_received_txn_response",
|
||||||
"set_received_txn_response",
|
"set_received_txn_response",
|
||||||
|
"get_destination_retry_timings",
|
||||||
]),
|
]),
|
||||||
handlers=None,
|
handlers=None,
|
||||||
resource_for_client=Mock(),
|
resource_for_client=Mock(),
|
||||||
@ -1048,6 +1053,9 @@ class PresencePollingTestCase(unittest.TestCase):
|
|||||||
hs.handlers = JustPresenceHandlers(hs)
|
hs.handlers = JustPresenceHandlers(hs)
|
||||||
|
|
||||||
self.datastore = hs.get_datastore()
|
self.datastore = hs.get_datastore()
|
||||||
|
self.datastore.get_destination_retry_timings.return_value = (
|
||||||
|
defer.succeed(DestinationsTable.EntryType("", 0, 0))
|
||||||
|
)
|
||||||
|
|
||||||
def get_received_txn_response(*args):
|
def get_received_txn_response(*args):
|
||||||
return defer.succeed(None)
|
return defer.succeed(None)
|
||||||
|
@ -25,6 +25,8 @@ from ..utils import MockHttpResource, MockClock, DeferredMockCallable, MockKey
|
|||||||
from synapse.server import HomeServer
|
from synapse.server import HomeServer
|
||||||
from synapse.handlers.typing import TypingNotificationHandler
|
from synapse.handlers.typing import TypingNotificationHandler
|
||||||
|
|
||||||
|
from synapse.storage.transactions import DestinationsTable
|
||||||
|
|
||||||
|
|
||||||
def _expect_edu(destination, edu_type, content, origin="test"):
|
def _expect_edu(destination, edu_type, content, origin="test"):
|
||||||
return {
|
return {
|
||||||
@ -49,7 +51,6 @@ class JustTypingNotificationHandlers(object):
|
|||||||
def __init__(self, hs):
|
def __init__(self, hs):
|
||||||
self.typing_notification_handler = TypingNotificationHandler(hs)
|
self.typing_notification_handler = TypingNotificationHandler(hs)
|
||||||
|
|
||||||
|
|
||||||
class TypingNotificationsTestCase(unittest.TestCase):
|
class TypingNotificationsTestCase(unittest.TestCase):
|
||||||
"""Tests typing notifications to rooms."""
|
"""Tests typing notifications to rooms."""
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -72,6 +73,7 @@ class TypingNotificationsTestCase(unittest.TestCase):
|
|||||||
"delivered_txn",
|
"delivered_txn",
|
||||||
"get_received_txn_response",
|
"get_received_txn_response",
|
||||||
"set_received_txn_response",
|
"set_received_txn_response",
|
||||||
|
"get_destination_retry_timings",
|
||||||
]),
|
]),
|
||||||
handlers=None,
|
handlers=None,
|
||||||
resource_for_client=Mock(),
|
resource_for_client=Mock(),
|
||||||
@ -89,6 +91,9 @@ class TypingNotificationsTestCase(unittest.TestCase):
|
|||||||
self.handler.push_update_to_clients = self.mock_update_client
|
self.handler.push_update_to_clients = self.mock_update_client
|
||||||
|
|
||||||
self.datastore = hs.get_datastore()
|
self.datastore = hs.get_datastore()
|
||||||
|
self.datastore.get_destination_retry_timings.return_value = (
|
||||||
|
defer.succeed(DestinationsTable.EntryType("", 0, 0))
|
||||||
|
)
|
||||||
|
|
||||||
def get_received_txn_response(*args):
|
def get_received_txn_response(*args):
|
||||||
return defer.succeed(None)
|
return defer.succeed(None)
|
||||||
|
Loading…
Reference in New Issue
Block a user