@@ -57,6 +57,12 @@ class DatabaseFeatures(GISFeatures, BaseDatabaseFeatures):
5757 supports_unspecified_pk = True
5858 uses_savepoints = False
5959
60+ disallowed_simple_test_case_connection_methods = [
61+ ("connect" , "connections" ),
62+ ("get_collection" , "queries" ),
63+ ("temporary_connection" , "connections" ),
64+ ]
65+
6066 _django_test_expected_failures = {
6167 # $concat only supports strings, not int
6268 "db_functions.text.test_concat.ConcatTests.test_concat_non_str" ,
@@ -92,6 +98,7 @@ class DatabaseFeatures(GISFeatures, BaseDatabaseFeatures):
9298 # Connection creation doesn't follow the usual Django API.
9399 "backends.tests.ThreadTests.test_pass_connection_between_threads" ,
94100 "backends.tests.ThreadTests.test_default_connection_thread_local" ,
101+ "test_utils.tests.DisallowedDatabaseQueriesTests.test_disallowed_thread_database_connection" ,
95102 # Object of type ObjectId is not JSON serializable.
96103 "auth_tests.test_views.LoginTest.test_login_session_without_hash_session_key" ,
97104 # GenericRelation.value_to_string() assumes integer pk.
@@ -438,15 +445,6 @@ def django_test_expected_failures(self):
438445 "servers.test_liveserverthread.LiveServerThreadTest.test_closes_connections" ,
439446 "servers.tests.LiveServerTestCloseConnectionTest.test_closes_connections" ,
440447 },
441- "Disallowed query protection doesn't work on MongoDB." : {
442- # Because this backend doesn't use cursor(), chunked_cursor(), etc.
443- # https://github.com/django/django/blob/045110ff3089aefd9c3e65c707df465bacfed986/django/test/testcases.py#L195-L206
444- "test_utils.test_testcase.TestTestCase.test_disallowed_database_queries" ,
445- "test_utils.test_transactiontestcase.DisallowedDatabaseQueriesTests.test_disallowed_database_queries" ,
446- "test_utils.tests.DisallowedDatabaseQueriesTests.test_disallowed_database_chunked_cursor_queries" ,
447- "test_utils.tests.DisallowedDatabaseQueriesTests.test_disallowed_database_queries" ,
448- "test_utils.tests.DisallowedDatabaseQueriesTests.test_disallowed_thread_database_connection" ,
449- },
450448 "search lookup not supported on non-Atlas until MongoDB 8.2." : {
451449 "expressions.tests.BasicExpressionsTests.test_lookups_subquery" ,
452450 },
0 commit comments