Move MockClock into tests.utils so we can reüse it
This commit is contained in:
parent
baf04be5cf
commit
fc778e2bce
|
@ -20,7 +20,7 @@ from twisted.trial import unittest
|
||||||
from mock import Mock
|
from mock import Mock
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from ..utils import MockHttpServer
|
from ..utils import MockHttpServer, MockClock
|
||||||
|
|
||||||
from synapse.server import HomeServer
|
from synapse.server import HomeServer
|
||||||
from synapse.federation import initialize_http_replication
|
from synapse.federation import initialize_http_replication
|
||||||
|
@ -48,16 +48,6 @@ def make_pdu(prev_pdus=[], **kwargs):
|
||||||
return PduTuple(PduEntry(**pdu_fields), prev_pdus)
|
return PduTuple(PduEntry(**pdu_fields), prev_pdus)
|
||||||
|
|
||||||
|
|
||||||
class MockClock(object):
|
|
||||||
now = 1000
|
|
||||||
|
|
||||||
def time(self):
|
|
||||||
return self.now
|
|
||||||
|
|
||||||
def time_msec(self):
|
|
||||||
return self.time() * 1000
|
|
||||||
|
|
||||||
|
|
||||||
class FederationTestCase(unittest.TestCase):
|
class FederationTestCase(unittest.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.mock_http_server = MockHttpServer()
|
self.mock_http_server = MockHttpServer()
|
||||||
|
|
|
@ -95,6 +95,16 @@ class MockHttpServer(HttpServer):
|
||||||
self.callbacks.append((method, path_pattern, callback))
|
self.callbacks.append((method, path_pattern, callback))
|
||||||
|
|
||||||
|
|
||||||
|
class MockClock(object):
|
||||||
|
now = 1000
|
||||||
|
|
||||||
|
def time(self):
|
||||||
|
return self.now
|
||||||
|
|
||||||
|
def time_msec(self):
|
||||||
|
return self.time() * 1000
|
||||||
|
|
||||||
|
|
||||||
class MemoryDataStore(object):
|
class MemoryDataStore(object):
|
||||||
|
|
||||||
class RoomMember(namedtuple(
|
class RoomMember(namedtuple(
|
||||||
|
|
Loading…
Reference in New Issue