Fix up tests
parent
32eb1dedd2
commit
414fa36f3e
|
@ -20,11 +20,11 @@ from mock import Mock
|
|||
|
||||
from twisted.internet import defer
|
||||
|
||||
from synapse.server import HomeServer
|
||||
from synapse.storage._base import SQLBaseStore
|
||||
from synapse.storage.engines import create_engine
|
||||
|
||||
from tests import unittest
|
||||
from tests.utils import TestHomeServer
|
||||
|
||||
|
||||
class SQLBaseStoreTestCase(unittest.TestCase):
|
||||
|
@ -51,7 +51,7 @@ class SQLBaseStoreTestCase(unittest.TestCase):
|
|||
config = Mock()
|
||||
config.event_cache_size = 1
|
||||
config.database_config = {"name": "sqlite3"}
|
||||
hs = HomeServer(
|
||||
hs = TestHomeServer(
|
||||
"test",
|
||||
db_pool=self.db_pool,
|
||||
config=config,
|
||||
|
|
|
@ -14,12 +14,12 @@
|
|||
# limitations under the License.
|
||||
|
||||
from synapse.api.errors import SynapseError
|
||||
from synapse.server import HomeServer
|
||||
from synapse.types import GroupID, RoomAlias, UserID
|
||||
|
||||
from tests import unittest
|
||||
from tests.utils import TestHomeServer
|
||||
|
||||
mock_homeserver = HomeServer(hostname="my.domain")
|
||||
mock_homeserver = TestHomeServer(hostname="my.domain")
|
||||
|
||||
|
||||
class UserIDTestCase(unittest.TestCase):
|
||||
|
|
|
@ -29,7 +29,7 @@ from synapse.api.errors import CodeMessageException, cs_error
|
|||
from synapse.federation.transport import server
|
||||
from synapse.http.server import HttpServer
|
||||
from synapse.server import HomeServer
|
||||
from synapse.storage import PostgresEngine
|
||||
from synapse.storage import DataStore, PostgresEngine
|
||||
from synapse.storage.engines import create_engine
|
||||
from synapse.storage.prepare_database import (
|
||||
_get_or_create_schema_state,
|
||||
|
@ -92,10 +92,14 @@ def setupdb():
|
|||
atexit.register(_cleanup)
|
||||
|
||||
|
||||
class TestHomeServer(HomeServer):
|
||||
DATASTORE_CLASS = DataStore
|
||||
|
||||
|
||||
@defer.inlineCallbacks
|
||||
def setup_test_homeserver(
|
||||
cleanup_func, name="test", datastore=None, config=None, reactor=None,
|
||||
homeserverToUse=HomeServer, **kargs
|
||||
homeserverToUse=TestHomeServer, **kargs
|
||||
):
|
||||
"""
|
||||
Setup a homeserver suitable for running tests against. Keyword arguments
|
||||
|
|
Loading…
Reference in New Issue