From 88cc5a986da5a8ae632459e2698a365445c20888 Mon Sep 17 00:00:00 2001 From: Jason Erickson Date: Fri, 28 Jan 2011 15:06:30 -0700 Subject: [PATCH] Use tests.dsn for the dsn connection string Using self.conn.dsn as the dsn connection string actually has the password 'x'ed out. The initial connection replaces the password with 'x' to obfuscate it. Using tests.dsn instead of self.conn.dsn ensures that the correct connection string is used. --- tests/test_connection.py | 2 +- tests/types_extras.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/test_connection.py b/tests/test_connection.py index 83661d92..01e73eb7 100755 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -135,7 +135,7 @@ class ConnectionTests(unittest.TestCase): def test_weakref(self): from weakref import ref - conn = psycopg2.connect(self.conn.dsn) + conn = psycopg2.connect(tests.dsn) w = ref(conn) conn.close() del conn diff --git a/tests/types_extras.py b/tests/types_extras.py index 6b258863..83faedde 100755 --- a/tests/types_extras.py +++ b/tests/types_extras.py @@ -266,7 +266,7 @@ class HstoreTestCase(unittest.TestCase): oids = HstoreAdapter.get_oids(self.conn) try: register_hstore(self.conn, globally=True) - conn2 = psycopg2.connect(self.conn.dsn) + conn2 = psycopg2.connect(tests.dsn) try: cur2 = self.conn.cursor() cur2.execute("select 'a => b'::hstore") @@ -484,8 +484,8 @@ class AdaptTypeTestCase(unittest.TestCase): def test_register_on_connection(self): self._create_type("type_ii", [("a", "integer"), ("b", "integer")]) - conn1 = psycopg2.connect(self.conn.dsn) - conn2 = psycopg2.connect(self.conn.dsn) + conn1 = psycopg2.connect(tests.dsn) + conn2 = psycopg2.connect(tests.dsn) try: psycopg2.extras.register_composite("type_ii", conn1) curs1 = conn1.cursor() @@ -502,8 +502,8 @@ class AdaptTypeTestCase(unittest.TestCase): def test_register_globally(self): self._create_type("type_ii", [("a", "integer"), ("b", "integer")]) - conn1 = psycopg2.connect(self.conn.dsn) - conn2 = psycopg2.connect(self.conn.dsn) + conn1 = psycopg2.connect(tests.dsn) + conn2 = psycopg2.connect(tests.dsn) try: t = psycopg2.extras.register_composite("type_ii", conn1, globally=True) try: