From d414b3e02a13822e7958165fd26aac0ab57ccbf2 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Sun, 23 Jun 2013 12:09:58 +0100
Subject: [PATCH] run functional tests on multiple backends

---
 .../tests/test_wsgiapp_complex_leveldb.py     | 23 +++++++++++++++++++
 .../tests/test_wsgiapp_complex_sqlalchemy.py  | 12 ++++++++++
 ...omplex.py => wsgiapp_complex_test_base.py} | 12 ++++------
 3 files changed, 39 insertions(+), 8 deletions(-)
 create mode 100644 configdb/tests/test_wsgiapp_complex_leveldb.py
 create mode 100644 configdb/tests/test_wsgiapp_complex_sqlalchemy.py
 rename configdb/tests/{test_wsgiapp_complex.py => wsgiapp_complex_test_base.py} (96%)

diff --git a/configdb/tests/test_wsgiapp_complex_leveldb.py b/configdb/tests/test_wsgiapp_complex_leveldb.py
new file mode 100644
index 0000000..8e3d439
--- /dev/null
+++ b/configdb/tests/test_wsgiapp_complex_leveldb.py
@@ -0,0 +1,23 @@
+try:
+    from configdb.db.interface import leveldb_interface
+except ImportError:
+    from nose.exc import SkipTest
+    raise SkipTest('LevelDB not found')
+
+from configdb.tests import *
+from configdb.tests.wsgiapp_complex_test_base import WsgiComplexTestBase
+
+
+class WsgiComplexLevelDbTest(WsgiComplexTestBase, WsgiTestBase):
+
+    def setUp(self):
+        WsgiTestBase.setUp(self)
+        WsgiComplexTestBase.setUp(self)
+
+    def get_app_args(self):
+        return {'DB_DRIVER': 'leveldb',
+                'DB_URI': self._tmpdir + '/db'}
+
+
+    
+    
diff --git a/configdb/tests/test_wsgiapp_complex_sqlalchemy.py b/configdb/tests/test_wsgiapp_complex_sqlalchemy.py
new file mode 100644
index 0000000..50a8008
--- /dev/null
+++ b/configdb/tests/test_wsgiapp_complex_sqlalchemy.py
@@ -0,0 +1,12 @@
+from configdb.tests import *
+from configdb.tests.wsgiapp_complex_test_base import WsgiComplexTestBase
+
+
+class WsgiComplexSQLAlchemyTest(WsgiComplexTestBase, WsgiTestBase):
+
+    def setUp(self):
+        WsgiTestBase.setUp(self)
+        WsgiComplexTestBase.setUp(self)
+
+    def get_app_args(self):
+        return {}
diff --git a/configdb/tests/test_wsgiapp_complex.py b/configdb/tests/wsgiapp_complex_test_base.py
similarity index 96%
rename from configdb/tests/test_wsgiapp_complex.py
rename to configdb/tests/wsgiapp_complex_test_base.py
index 3ab1766..5bed3ee 100644
--- a/configdb/tests/test_wsgiapp_complex.py
+++ b/configdb/tests/wsgiapp_complex_test_base.py
@@ -1,18 +1,14 @@
 import json
-import os
 from werkzeug.exceptions import Forbidden
 from datetime import datetime
-from configdb.db import acl
-from configdb.tests import *
+#from configdb.tests import *
 
 
-
-class WsgiComplexTest(WsgiTestBase):
+class WsgiComplexTestBase(object):
 
     def setUp(self):
-        WsgiTestBase.setUp(self)
-
-        app = self.create_app_with_schema('schema-large-noacl.json')
+        args = self.get_app_args()
+        app = self.create_app_with_schema('schema-large-noacl.json', **args)
         self.wsgiapp = app
         self.app = app.test_client()
 
-- 
GitLab