diff idavoll/test/test_storage.py @ 204:b4bf0a5ce50d

Implement storage facilities for the HTTP gateway. Author: ralphm. Fixes #12. One of the storage facilities is PostgreSQL based, providing persistence.
author Ralph Meijer <ralphm@ik.nu>
date Wed, 16 Jul 2008 06:38:32 +0000
parents 77c61e2b8c75
children 274a45d2a5ab
line wrap: on
line diff
--- a/idavoll/test/test_storage.py	Mon Jul 14 09:16:16 2008 +0000
+++ b/idavoll/test/test_storage.py	Wed Jul 16 06:38:32 2008 +0000
@@ -414,22 +414,24 @@
 
 
 class PgsqlStorageStorageTestCase(unittest.TestCase, StorageTests):
-    def _callSuperSetUp(self, void):
-        return StorageTests.setUp(self)
-
 
     def setUp(self):
         from idavoll.pgsql_storage import Storage
-        self.s = Storage('ralphm', 'pubsub_test')
-        self.s._dbpool.start()
-        d = self.s._dbpool.runInteraction(self.init)
-        d.addCallback(self._callSuperSetUp)
+        from twisted.enterprise import adbapi
+        self.dbpool = adbapi.ConnectionPool('pyPgSQL.PgSQL',
+                                            database='pubsub_test',
+                                            cp_reconnect=True,
+                                            client_encoding='utf-8',
+                                            )
+        self.s = Storage(self.dbpool)
+        self.dbpool.start()
+        d = self.dbpool.runInteraction(self.init)
+        d.addCallback(lambda _: StorageTests.setUp(self))
         return d
 
 
-    def tearDownClass(self):
-        #return self.s._dbpool.runInteraction(self.cleandb)
-        pass
+    def tearDown(self):
+        return self.dbpool.runInteraction(self.cleandb)
 
 
     def init(self, cursor):