Skip to content

Commit 5087d78

Browse files
committed
backends edits
1 parent 9d5d079 commit 5087d78

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

tests/backends/base/test_base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,8 @@ def test_multi_database_init_connection_state_called_once(self):
383383
connections[db],
384384
"check_database_version_supported",
385385
) as mocked_check_database_version_supported:
386+
if connections[db].connection is None:
387+
connections[db].connection.connect()
386388
connections[db].init_connection_state()
387389
after_first_calls = len(
388390
mocked_check_database_version_supported.mock_calls

tests/backends/tests.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def test_last_executed_query_without_previous_query(self):
7979
def test_debug_sql(self):
8080
list(Reporter.objects.filter(first_name="test"))
8181
sql = connection.queries[-1]["sql"].lower()
82-
self.assertIn("select", sql)
82+
self.assertIn("$match", sql)
8383
self.assertIn(Reporter._meta.db_table, sql)
8484

8585
def test_query_encoding(self):
@@ -261,14 +261,12 @@ def receiver(sender, connection, **kwargs):
261261

262262
connection_created.connect(receiver)
263263
connection.close()
264-
with connection.cursor():
265-
pass
264+
connection.connect()
266265
self.assertIs(data["connection"].connection, connection.connection)
267-
266+
connection.close()
268267
connection_created.disconnect(receiver)
269268
data.clear()
270-
with connection.cursor():
271-
pass
269+
connection.connect()
272270
self.assertEqual(data, {})
273271

274272

0 commit comments

Comments
 (0)