summary refs log tree commit diff
path: root/tests/utils.py
diff options
context:
space:
mode:
authorDaniel Wagner-Hall <dawagner@gmail.com>2016-03-03 13:56:28 +0000
committerDaniel Wagner-Hall <dawagner@gmail.com>2016-03-03 13:56:28 +0000
commit95481e7ba70fd5745c409ef285ed6bd0def81426 (patch)
treee4d4b3c6215a228055ea3108fa3b0d3b87ecde0d /tests/utils.py
parentjenkins.sh: set -x (diff)
parentMark AS users with their AS's ID (diff)
downloadsynapse-95481e7ba70fd5745c409ef285ed6bd0def81426.tar.xz
Merge pull request #571 from matrix-org/daniel/asids
Mark AS users with their AS's ID
Diffstat (limited to '')
-rw-r--r--tests/utils.py20
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/utils.py b/tests/utils.py
index dfbee5c23a..c67fa1ca35 100644
--- a/tests/utils.py
+++ b/tests/utils.py
@@ -51,6 +51,8 @@ def setup_test_homeserver(name="test", datastore=None, config=None, **kargs):
         config.server_name = "server.under.test"
         config.trusted_third_party_id_servers = []
 
+    config.database_config = {"name": "sqlite3"}
+
     if "clock" not in kargs:
         kargs["clock"] = MockClock()
 
@@ -60,7 +62,7 @@ def setup_test_homeserver(name="test", datastore=None, config=None, **kargs):
         hs = HomeServer(
             name, db_pool=db_pool, config=config,
             version_string="Synapse/tests",
-            database_engine=create_engine("sqlite3"),
+            database_engine=create_engine(config),
             get_db_conn=db_pool.get_db_conn,
             **kargs
         )
@@ -69,7 +71,7 @@ def setup_test_homeserver(name="test", datastore=None, config=None, **kargs):
         hs = HomeServer(
             name, db_pool=None, datastore=datastore, config=config,
             version_string="Synapse/tests",
-            database_engine=create_engine("sqlite3"),
+            database_engine=create_engine(config),
             **kargs
         )
 
@@ -278,18 +280,24 @@ class SQLiteMemoryDbPool(ConnectionPool, object):
             cp_max=1,
         )
 
+        self.config = Mock()
+        self.config.database_config = {"name": "sqlite3"}
+
     def prepare(self):
-        engine = create_engine("sqlite3")
+        engine = self.create_engine()
         return self.runWithConnection(
-            lambda conn: prepare_database(conn, engine)
+            lambda conn: prepare_database(conn, engine, self.config)
         )
 
     def get_db_conn(self):
         conn = self.connect()
-        engine = create_engine("sqlite3")
-        prepare_database(conn, engine)
+        engine = self.create_engine()
+        prepare_database(conn, engine, self.config)
         return conn
 
+    def create_engine(self):
+        return create_engine(self.config)
+
 
 class MemoryDataStore(object):