MCPcopy
hub / github.com/django/django / test_save_button

Method test_save_button

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

Source from the content-addressed store, hash-verified

8050 self.client.force_login(self.superuser)
8051
8052 def test_save_button(self):
8053 user_count = User.objects.count()
8054 response = self.client.post(
8055 reverse("admin:auth_user_add"),
8056 {
8057 "username": "newuser",
8058 "password1": "newpassword",
8059 "password2": "newpassword",
8060 },
8061 )
8062 new_user = User.objects.get(username="newuser")
8063 self.assertRedirects(
8064 response, reverse("admin:auth_user_change", args=(new_user.pk,))
8065 )
8066 self.assertEqual(User.objects.count(), user_count + 1)
8067 self.assertTrue(new_user.has_usable_password())
8068
8069 def test_save_continue_editing_button(self):
8070 user_count = User.objects.count()

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected