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.
This commit is contained in:
Jason Erickson 2011-01-28 15:06:30 -07:00
parent dcd2e19bde
commit 88cc5a986d
2 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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: