summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--keystonelight/backends/sql/util.py16
-rw-r--r--tests/backend_sql.conf9
-rw-r--r--tests/test_backend_sql.py6
-rw-r--r--tests/test_keystoneclient.py (renamed from tests/test_keystoneclient_compat.py)5
-rw-r--r--tests/test_keystoneclient_sql.py16
5 files changed, 46 insertions, 6 deletions
diff --git a/keystonelight/backends/sql/util.py b/keystonelight/backends/sql/util.py
new file mode 100644
index 00000000..64443ef7
--- /dev/null
+++ b/keystonelight/backends/sql/util.py
@@ -0,0 +1,16 @@
+import os
+
+from keystonelight import config
+from keystonelight.backends.sql import migration
+
+
+CONF = config.CONF
+
+
+def setup_test_database():
+ # TODO(termie): be smart about this
+ try:
+ os.unlink('bla.db')
+ except Exception:
+ pass
+ migration.db_sync()
diff --git a/tests/backend_sql.conf b/tests/backend_sql.conf
new file mode 100644
index 00000000..41dccf30
--- /dev/null
+++ b/tests/backend_sql.conf
@@ -0,0 +1,9 @@
+[sql]
+connection = sqlite:///bla.db
+idle_timeout = 200
+min_pool_size = 5
+max_pool_size = 10
+pool_timeout = 200
+
+[identity]
+driver = keystonelight.backends.sql.SqlIdentity
diff --git a/tests/test_backend_sql.py b/tests/test_backend_sql.py
index 2bdc2245..d80e5bfd 100644
--- a/tests/test_backend_sql.py
+++ b/tests/test_backend_sql.py
@@ -5,7 +5,7 @@ from keystonelight import config
from keystonelight import models
from keystonelight import test
from keystonelight.backends import sql
-from keystonelight.backends.sql import migration
+from keystonelight.backends.sql import util as sql_util
import test_backend
import default_fixtures
@@ -22,8 +22,8 @@ class SqlIdentity(test.TestCase, test_backend.IdentityTests):
os.unlink('bla.db')
except Exception:
pass
- CONF(config_files=['default.conf'])
- migration.db_sync(1)
+ CONF(config_files=['default.conf', 'backend_sql.conf'])
+ sql_util.setup_test_database()
self.identity_api = sql.SqlIdentity()
self.load_fixtures(default_fixtures)
diff --git a/tests/test_keystoneclient_compat.py b/tests/test_keystoneclient.py
index fc757d65..0efd3ca8 100644
--- a/tests/test_keystoneclient_compat.py
+++ b/tests/test_keystoneclient.py
@@ -34,9 +34,9 @@ class CompatTestCase(test.TestCase):
return kc
-class MasterCompatTestCase(CompatTestCase):
+class KcMasterTestCase(CompatTestCase):
def setUp(self):
- super(MasterCompatTestCase, self).setUp()
+ super(KcMasterTestCase, self).setUp()
revdir = test.checkout_vendor(KEYSTONECLIENT_REPO, 'master')
self.add_path(revdir)
@@ -64,7 +64,6 @@ class MasterCompatTestCase(CompatTestCase):
def _config(self):
CONF(config_files=['default.conf'])
-
def foo_client(self):
return self._client(username='FOO',
password='foo2',
diff --git a/tests/test_keystoneclient_sql.py b/tests/test_keystoneclient_sql.py
new file mode 100644
index 00000000..eafbd1f7
--- /dev/null
+++ b/tests/test_keystoneclient_sql.py
@@ -0,0 +1,16 @@
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
+from keystonelight import config
+from keystonelight import test
+from keystonelight.backends.sql import util as sql_util
+from keystonelight.backends.sql import migration
+
+import test_keystoneclient
+
+
+CONF = config.CONF
+
+
+class KcMasterSqlTestCase(test_keystoneclient.KcMasterTestCase):
+ def _config(self):
+ CONF(config_files=['default.conf', 'backend_sql.conf'])
+ sql_util.setup_test_database()