Add tests for specifying only the encoding or only the nencoding.

This commit is contained in:
Anthony Tuininga 2017-06-10 11:32:25 -06:00
parent 2f76f33f20
commit f4009ebabd
1 changed files with 15 additions and 0 deletions

View File

@ -53,6 +53,21 @@ class TestConnection(TestCase):
self.assertRaises(cx_Oracle.DatabaseError, cx_Oracle.connect,
self.username, self.password + "X", self.tnsentry)
def testEncodings(self):
"connection with only encoding or nencoding specified should work"
connection = cx_Oracle.connect(self.username, self.password,
self.tnsentry)
encoding = connection.encoding
nencoding = connection.nencoding
connection = cx_Oracle.connect(self.username, self.password,
self.tnsentry, encoding = "UTF-8")
self.assertEqual(connection.encoding, "UTF-8")
self.assertEqual(connection.nencoding, nencoding)
connection = cx_Oracle.connect(self.username, self.password,
self.tnsentry, nencoding = "UTF-8")
self.assertEqual(connection.encoding, encoding)
self.assertEqual(connection.nencoding, "UTF-8")
def testExceptionOnClose(self):
"confirm an exception is raised after closing a connection"
connection = cx_Oracle.connect(self.username, self.password,