(self)
| 122 | self.assertTrue(mocked_get_database_version.called) |
| 123 | |
| 124 | def test_init_command(self): |
| 125 | settings_dict = { |
| 126 | "default": { |
| 127 | "ENGINE": "django.db.backends.sqlite3", |
| 128 | "NAME": ":memory:", |
| 129 | "OPTIONS": { |
| 130 | "init_command": "PRAGMA synchronous=3; PRAGMA cache_size=2000;", |
| 131 | }, |
| 132 | } |
| 133 | } |
| 134 | connections = ConnectionHandler(settings_dict) |
| 135 | connections["default"].ensure_connection() |
| 136 | try: |
| 137 | with connections["default"].cursor() as cursor: |
| 138 | cursor.execute("PRAGMA synchronous") |
| 139 | value = cursor.fetchone()[0] |
| 140 | self.assertEqual(value, 3) |
| 141 | cursor.execute("PRAGMA cache_size") |
| 142 | value = cursor.fetchone()[0] |
| 143 | self.assertEqual(value, 2000) |
| 144 | finally: |
| 145 | connections["default"]._close() |
| 146 | |
| 147 | |
| 148 | @unittest.skipUnless(connection.vendor == "sqlite", "SQLite tests") |
nothing calls this directly
no test coverage detected