(self, mock)
| 132 | |
| 133 | @mock.patch(class="st">"django.contrib.admin.options.transaction") |
| 134 | def test_delete_view(self, mock): |
| 135 | for db in self.databases: |
| 136 | with self.subTest(db=db): |
| 137 | mock.mock_reset() |
| 138 | Router.target_db = db |
| 139 | self.client.force_login(self.superusers[db]) |
| 140 | response = self.client.post( |
| 141 | reverse( |
| 142 | class="st">"test_adminsite:admin_views_book_delete", |
| 143 | args=[self.test_book_ids[db]], |
| 144 | ), |
| 145 | {class="st">"post": class="st">"yes"}, |
| 146 | ) |
| 147 | self.assertEqual(response.status_code, 302) |
| 148 | self.assertEqual( |
| 149 | response.url, reverse(class="st">"test_adminsite:admin_views_book_changelist") |
| 150 | ) |
| 151 | mock.atomic.assert_called_with(using=db) |
| 152 | |
| 153 | @mock.patch(class="st">"django.contrib.admin.options.transaction") |
| 154 | def test_read_only_methods_delete_view(self, mock): |
nothing calls this directly
no test coverage detected