1
0
mirror of https://github.com/django/django.git synced 2025-10-24 14:16:09 +00:00

Fixed #29199 -- Fixed crash when database user password contains @ sign on Oracle.

Thanks Shane Allgeier for the report and Tim Graham for the review.
This commit is contained in:
Mariusz Felisiak
2018-03-13 19:06:40 +01:00
committed by GitHub
parent 22bcd3a1d8
commit acfc650f2a
2 changed files with 26 additions and 10 deletions

View File

@@ -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