Mercurial > libervia-pubsub
diff idavoll/test/test_storage.py @ 227:8540825f85e0
Replaced unmaintained pyPgSQL by Psycopg 2
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 17 May 2012 00:31:36 +0200 |
parents | b7018ec56ee5 |
children |
line wrap: on
line diff
--- a/idavoll/test/test_storage.py Sun Feb 13 21:46:33 2011 +0100 +++ b/idavoll/test/test_storage.py Thu May 17 00:31:36 2012 +0200 @@ -480,7 +480,7 @@ from idavoll.pgsql_storage import Storage from twisted.enterprise import adbapi if self.dbpool is None: - self.__class__.dbpool = adbapi.ConnectionPool('pyPgSQL.PgSQL', + self.__class__.dbpool = adbapi.ConnectionPool('psycopg2', database='pubsub_test', cp_reconnect=True, client_encoding='utf-8', @@ -505,15 +505,15 @@ cursor.execute("""INSERT INTO nodes (node) VALUES ('to-be-reconfigured')""") cursor.execute("""INSERT INTO nodes (node) VALUES ('to-be-purged')""") cursor.execute("""INSERT INTO entities (jid) VALUES (%s)""", - OWNER.userhost()) + (OWNER.userhost(),)) cursor.execute("""INSERT INTO affiliations (node_id, entity_id, affiliation) SELECT node_id, entity_id, 'owner' FROM nodes, entities WHERE node='pre-existing' AND jid=%s""", - OWNER.userhost()) + (OWNER.userhost(),)) cursor.execute("""INSERT INTO entities (jid) VALUES (%s)""", - SUBSCRIBER.userhost()) + (SUBSCRIBER.userhost(),)) cursor.execute("""INSERT INTO subscriptions (node_id, entity_id, resource, state) SELECT node_id, entity_id, %s, 'subscribed' @@ -522,7 +522,7 @@ (SUBSCRIBER.resource, SUBSCRIBER.userhost())) cursor.execute("""INSERT INTO entities (jid) VALUES (%s)""", - SUBSCRIBER_TO_BE_DELETED.userhost()) + (SUBSCRIBER_TO_BE_DELETED.userhost(),)) cursor.execute("""INSERT INTO subscriptions (node_id, entity_id, resource, state) SELECT node_id, entity_id, %s, 'subscribed' @@ -531,7 +531,7 @@ (SUBSCRIBER_TO_BE_DELETED.resource, SUBSCRIBER_TO_BE_DELETED.userhost())) cursor.execute("""INSERT INTO entities (jid) VALUES (%s)""", - SUBSCRIBER_PENDING.userhost()) + (SUBSCRIBER_PENDING.userhost(),)) cursor.execute("""INSERT INTO subscriptions (node_id, entity_id, resource, state) SELECT node_id, entity_id, %s, 'pending' @@ -540,7 +540,7 @@ (SUBSCRIBER_PENDING.resource, SUBSCRIBER_PENDING.userhost())) cursor.execute("""INSERT INTO entities (jid) VALUES (%s)""", - PUBLISHER.userhost()) + (PUBLISHER.userhost(),)) cursor.execute("""INSERT INTO items (node_id, publisher, item, data, date) SELECT node_id, %s, 'to-be-deleted', %s, @@ -569,18 +569,17 @@ 'new 1', 'new 2', 'new 3', 'to-be-reconfigured', 'to-be-purged')""") cursor.execute("""DELETE FROM entities WHERE jid=%s""", - OWNER.userhost()) + (OWNER.userhost(),)) cursor.execute("""DELETE FROM entities WHERE jid=%s""", - SUBSCRIBER.userhost()) + (SUBSCRIBER.userhost(),)) cursor.execute("""DELETE FROM entities WHERE jid=%s""", - SUBSCRIBER_TO_BE_DELETED.userhost()) + (SUBSCRIBER_TO_BE_DELETED.userhost(),)) cursor.execute("""DELETE FROM entities WHERE jid=%s""", - SUBSCRIBER_PENDING.userhost()) + (SUBSCRIBER_PENDING.userhost(),)) cursor.execute("""DELETE FROM entities WHERE jid=%s""", - PUBLISHER.userhost()) + (PUBLISHER.userhost(),)) try: - import pyPgSQL - pyPgSQL + import psycopg2 except ImportError: - PgsqlStorageStorageTestCase.skip = "pyPgSQL not available" + PgsqlStorageStorageTestCase.skip = "Psycopg2 not available"