mirror of
https://github.com/django/django.git
synced 2025-07-12 15:55:13 +00:00
Fixed #34466 -- Reallowed setting cursor_factory in DATABASES["options"] on PostgreSQL.
Regression in 09ffc5c121
.
This commit is contained in:
parent
9daf8b4109
commit
73cbb372ba
3 changed files with 30 additions and 9 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue