MCPcopy
hub / github.com/django/django / test_save_add_another_button

Method test_save_add_another_button

tests/admin_views/tests.py:8200–8214  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

8198 self.assertContains(response, ""action": "delete"")
8199
8200 def test_save_add_another_button(self):
8201 user_count = User.objects.count()
8202 response = self.client.post(
8203 reverse("admin:auth_user_add"),
8204 {
8205 "username": "newuser",
8206 "password1": "newpassword",
8207 "password2": "newpassword",
8208 "_addanother": "1",
8209 },
8210 )
8211 new_user = User.objects.order_by("-id")[0]
8212 self.assertRedirects(response, reverse("admin:auth_user_add"))
8213 self.assertEqual(User.objects.count(), user_count + 1)
8214 self.assertTrue(new_user.has_usable_password())
8215
8216 def test_user_permission_performance(self):
8217 u = User.objects.all()[0]

Callers

nothing calls this directly

Calls 6

reverseFunction · 0.90
order_byMethod · 0.80
assertRedirectsMethod · 0.80
has_usable_passwordMethod · 0.80
countMethod · 0.45
postMethod · 0.45

Tested by

no test coverage detected