diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2017-03-16 03:33:19 +0000 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2017-03-16 03:53:40 +0000 |
commit | 9f160fd8208f5bad8a724881384835b8e692bad0 (patch) | |
tree | 8e416d58dff49457cd139913e27403ebcce61f93 /tests | |
parent | 103655d67086a3377668236662363fa3146fbd32 (diff) | |
download | psycopg2-9f160fd8208f5bad8a724881384835b8e692bad0.tar.gz |
Obscure the password on url dsn too
Note that we don't leak anymore the password length.
Fix #528
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/test_connection.py | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/tests/test_connection.py b/tests/test_connection.py index dcf3a4a..f61b099 100755 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -1504,19 +1504,16 @@ class PasswordLeakTestCase(ConnectingTestCase): def test_leak(self): self.assertRaises(psycopg2.DatabaseError, self.GrassingConnection, "dbname=nosuch password=whateva") + self.assertDsnEqual(self.dsn, "dbname=nosuch password=xxx") - self.assert_('nosuch' in self.dsn) - self.assert_('password' in self.dsn) - self.assert_('whateva' not in self.dsn) - + @skip_before_libpq(9, 2) def test_url_leak(self): self.assertRaises(psycopg2.DatabaseError, self.GrassingConnection, "postgres://someone:whateva@localhost/nosuch") - self.assert_('nosuch' in self.dsn) - self.assert_('someone' in self.dsn) - self.assert_('whateva' not in self.dsn) + self.assertDsnEqual(self.dsn, + "user=someone password=xxx host=localhost dbname=nosuch") def test_suite(): |