diff options
| author | Anders Kaseorg <andersk@mit.edu> | 2023-04-06 12:44:37 -0700 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2023-04-07 08:02:34 +0200 |
| commit | 73cbb372baa45d1fdafd571e2f430a980831f722 (patch) | |
| tree | 10d34ca32d823cd6ef09f2727ac359fda6f74d18 /tests/backends | |
| parent | 9daf8b4109c3e133eb57349bb44d73cc60c5773c (diff) | |
| download | django-73cbb372baa45d1fdafd571e2f430a980831f722.tar.gz | |
Fixed #34466 -- Reallowed setting cursor_factory in DATABASES["options"] on PostgreSQL.
Regression in 09ffc5c1212d4ced58b708cbbf3dfbfb77b782ca.
Diffstat (limited to 'tests/backends')
| -rw-r--r-- | tests/backends/postgresql/tests.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/backends/postgresql/tests.py b/tests/backends/postgresql/tests.py index ab66e7ab0e..5589daa0c2 100644 --- a/tests/backends/postgresql/tests.py +++ b/tests/backends/postgresql/tests.py @@ -296,6 +296,24 @@ class Tests(TestCase): finally: new_connection.close() + def test_connect_custom_cursor_factory(self): + """ + A custom cursor factory can be configured with DATABASES["options"] + ["cursor_factory"]. + """ + from django.db.backends.postgresql.base import Cursor + + class MyCursor(Cursor): + pass + + new_connection = connection.copy() + new_connection.settings_dict["OPTIONS"]["cursor_factory"] = MyCursor + try: + new_connection.connect() + self.assertEqual(new_connection.connection.cursor_factory, MyCursor) + finally: + new_connection.close() + def test_connect_no_is_usable_checks(self): new_connection = connection.copy() try: |
