Move MockClock into tests.utils so we can reüse it

This commit is contained in:
Paul "LeoNerd" Evans 2014-08-13 18:26:42 +01:00
parent baf04be5cf
commit fc778e2bce
2 changed files with 11 additions and 11 deletions

View File

@ -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()

View File

@ -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(