From 0336aa6672ea91a30ff5ab12b655c0ee6a00fa73 Mon Sep 17 00:00:00 2001 From: Mariusz Felisiak Date: Fri, 4 Aug 2023 17:36:04 +0200 Subject: [PATCH] Fixed TransactionalTests.test_password_with_at_sign() isolation on Oracle. --- tests/backends/oracle/tests.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/backends/oracle/tests.py b/tests/backends/oracle/tests.py index 9a4e8ad4356..1ad98a88cf2 100644 --- a/tests/backends/oracle/tests.py +++ b/tests/backends/oracle/tests.py @@ -103,6 +103,8 @@ class TransactionalTests(TransactionTestCase): cursor.execute('DROP TRIGGER "TRG_NO_DATA_FOUND"') def test_password_with_at_sign(self): + from django.db.backends.oracle.base import Database + old_password = connection.settings_dict["PASSWORD"] connection.settings_dict["PASSWORD"] = "p@ssword" try: @@ -110,8 +112,8 @@ class TransactionalTests(TransactionTestCase): '/"p@ssword"@', connection.client.connect_string(connection.settings_dict), ) - with self.assertRaises(DatabaseError) as context: - connection.cursor() + with self.assertRaises(Database.DatabaseError) as context: + connection.connect() # Database exception: "ORA-01017: invalid username/password" is # expected. self.assertIn("ORA-01017", context.exception.args[0].message)