(self, mock)
| 94 | |
| 95 | @mock.patch("django.contrib.admin.options.transaction") |
| 96 | def test_change_view(self, mock): |
| 97 | for db in self.databases: |
| 98 | with self.subTest(db=db): |
| 99 | mock.mock_reset() |
| 100 | Router.target_db = db |
| 101 | self.client.force_login(self.superusers[db]) |
| 102 | response = self.client.post( |
| 103 | reverse( |
| 104 | "test_adminsite:admin_views_book_change", |
| 105 | args=[self.test_book_ids[db]], |
| 106 | ), |
| 107 | {"name": "Test Book 2: Test more"}, |
| 108 | ) |
| 109 | self.assertEqual(response.status_code, 302) |
| 110 | self.assertEqual( |
| 111 | response.url, reverse("test_adminsite:admin_views_book_changelist") |
| 112 | ) |
| 113 | mock.atomic.assert_called_with(using=db) |
| 114 | |
| 115 | @mock.patch("django.contrib.admin.options.transaction") |
| 116 | def test_read_only_methods_change_view(self, mock): |
nothing calls this directly
no test coverage detected