MCPcopy
hub / github.com/django/django / test_add_view

Method test_add_view

tests/admin_views/test_multidb.py:65–79  ·  view source on GitHub ↗
(self, mock)

Source from the content-addressed store, hash-verified

63
64 @mock.patch("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("test_adminsite:admin_views_book_add"),
73 {"name": "Foobar: 5th edition"},
74 )
75 self.assertEqual(response.status_code, 302)
76 self.assertEqual(
77 response.url, reverse("test_adminsite:admin_views_book_changelist")
78 )
79 mock.atomic.assert_called_with(using=db)
80
81 @mock.patch("django.contrib.admin.options.transaction")
82 def test_read_only_methods_add_view(self, mock):

Callers

nothing calls this directly

Calls 3

reverseFunction · 0.90
force_loginMethod · 0.80
postMethod · 0.45

Tested by

no test coverage detected