diff options
author | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2018-10-13 03:09:39 +0100 |
---|---|---|
committer | Daniele Varrazzo <daniele.varrazzo@gmail.com> | 2018-10-13 03:09:39 +0100 |
commit | 704e6797e7dd4ac0046caa3230a8faa1f247859f (patch) | |
tree | 76339016ed90ba5d4f1b4a1f62dfb9f98b01a36e /tests/test_connection.py | |
parent | d138e42ee5ac39797ae6b563ddd87eca3166b458 (diff) | |
download | psycopg2-704e6797e7dd4ac0046caa3230a8faa1f247859f.tar.gz |
Guard from some info functions not available in some libpq versions
Diffstat (limited to 'tests/test_connection.py')
-rwxr-xr-x | tests/test_connection.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/test_connection.py b/tests/test_connection.py index 0b68389..cb70bb0 100755 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -1803,10 +1803,21 @@ class TestConnectionInfo(ConnectingTestCase): self.assertIsInstance(self.conn.info.used_password, bool) self.assertIs(self.bconn.info.used_password, False) + @skip_before_libpq(9, 5) def test_ssl_in_use(self): self.assertIsInstance(self.conn.info.ssl_in_use, bool) self.assertIs(self.bconn.info.ssl_in_use, False) + @skip_after_libpq(9, 5) + def test_ssl_not_supported(self): + with self.assertRaises(psycopg2.NotSupportedError): + self.conn.info.ssl_in_use + with self.assertRaises(psycopg2.NotSupportedError): + self.conn.info.ssl_attribute_names + with self.assertRaises(psycopg2.NotSupportedError): + self.conn.info.ssl_attribute('wat') + + @skip_before_libpq(9, 5) def test_ssl_attribute(self): attribs = self.conn.info.ssl_attribute_names self.assert_(attribs) |