(self, mock)
| 63 | |
| 64 | @mock.patch(class="st">"django.contrib.admin.options.transaction") |
| 65 | def test_add_view(self, mock): |
| 66 | for db in self.databases: |
| 67 | with self.subTest(db=db): |
| 68 | mock.mock_reset() |
| 69 | Router.target_db = db |
| 70 | self.client.force_login(self.superusers[db]) |
| 71 | response = self.client.post( |
| 72 | reverse(class="st">"test_adminsite:admin_views_book_add"), |
| 73 | {class="st">"name": class="st">"Foobar: 5th edition"}, |
| 74 | ) |
| 75 | self.assertEqual(response.status_code, 302) |
| 76 | self.assertEqual( |
| 77 | response.url, reverse(class="st">"test_adminsite:admin_views_book_changelist") |
| 78 | ) |
| 79 | mock.atomic.assert_called_with(using=db) |
| 80 | |
| 81 | @mock.patch(class="st">"django.contrib.admin.options.transaction") |
| 82 | def test_read_only_methods_add_view(self, mock): |
nothing calls this directly
no test coverage detected