From acfc650f2a6e4a79e80237eabfa923ea3a05d709 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Tue, 13 Mar 2018 19:06:40 +0100 Subject: Fixed #29199 -- Fixed crash when database user password contains @ sign on Oracle. Thanks Shane Allgeier for the report and Tim Graham for the review. --- tests/backends/oracle/tests.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/backends/oracle/tests.py b/tests/backends/oracle/tests.py index 6896419778..77de9cf279 100644 --- a/tests/backends/oracle/tests.py +++ b/tests/backends/oracle/tests.py @@ -57,7 +57,7 @@ class Tests(unittest.TestCase): @unittest.skipUnless(connection.vendor == 'oracle', 'Oracle tests') -class HiddenNoDataFoundExceptionTest(TransactionTestCase): +class TransactionalTests(TransactionTestCase): available_apps = ['backends'] def test_hidden_no_data_found_exception(self): @@ -83,3 +83,16 @@ class HiddenNoDataFoundExceptionTest(TransactionTestCase): finally: with connection.cursor() as cursor: cursor.execute('DROP TRIGGER "TRG_NO_DATA_FOUND"') + + def test_password_with_at_sign(self): + old_password = connection.settings_dict['PASSWORD'] + connection.settings_dict['PASSWORD'] = 'p@ssword' + try: + self.assertIn('/\\"p@ssword\\"@', connection._connect_string()) + with self.assertRaises(DatabaseError) as context: + connection.cursor() + # Database exception: "ORA-01017: invalid username/password" is + # expected. + self.assertIn('ORA-01017', context.exception.args[0].message) + finally: + connection.settings_dict['PASSWORD'] = old_password -- cgit v1.3