Fix replication tests

This commit is contained in:
Erik Johnston 2014-12-11 17:11:06 +00:00
parent d3eb12c7b8
commit 3fecacd86b

View File

@ -23,25 +23,20 @@ from ..utils import MockHttpResource, MockClock, MockKey
from synapse.server import HomeServer 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.events import FrozenEvent
from synapse.storage.transactions import DestinationsTable 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."""
pdu_fields = { pdu_fields = {
"is_state": False,
"unrecognized_keys": [],
"outlier": False,
"have_processed": True,
"state_key": None, "state_key": None,
"power_level": None, "prev_events": prev_pdus,
"prev_state_id": None,
"prev_state_origin": None,
} }
pdu_fields.update(kwargs) pdu_fields.update(kwargs)
return SynapseEvent(prev_pdus=prev_pdus, **pdu_fields) return FrozenEvent(pdu_fields)
class FederationTestCase(unittest.TestCase): class FederationTestCase(unittest.TestCase):
@ -176,7 +171,7 @@ class FederationTestCase(unittest.TestCase):
(200, "OK") (200, "OK")
) )
pdu = SynapseEvent( pdu = make_pdu(
event_id="abc123def456", event_id="abc123def456",
origin="red", origin="red",
user_id="@a:red", user_id="@a:red",
@ -185,10 +180,9 @@ class FederationTestCase(unittest.TestCase):
origin_server_ts=123456789001, origin_server_ts=123456789001,
depth=1, depth=1,
content={"text": "Here is the message"}, content={"text": "Here is the message"},
destinations=["remote"],
) )
yield self.federation.send_pdu(pdu) yield self.federation.send_pdu(pdu, ["remote"])
self.mock_http_client.put_json.assert_called_with( self.mock_http_client.put_json.assert_called_with(
"remote", "remote",