'encrypt_password' raises 'psycopg2.NotSupportedErorr' exception for

server version >= 10, when compiled using libpq version < 10, when no
algorithm is specified.
This commit is contained in:
Ashesh Vashi 2017-07-17 11:46:44 +05:30
parent 2c1966a7f6
commit e089d94c88

View File

@ -1397,16 +1397,10 @@ class TransactionControlTests(ConnectingTestCase):
)
if libpq_version() < 100000:
if server_encryption_algorithm == 'md5':
self.assertEqual(
self.conn.encrypt_password('psycopg2', 'ashesh'),
'md594839d658c28a357126f105b9cb14cfc'
)
else:
self.assertRaises(
psycopg2.NotSupportedError,
self.conn.encrypt_password, 'psycopg2', 'ashesh'
)
self.assertRaises(
psycopg2.NotSupportedError,
self.conn.encrypt_password, 'psycopg2', 'ashesh'
)
else:
enc_password = self.conn.encrypt_password('psycopg2', 'ashesh')
if server_encryption_algorithm == 'md5':