MCPcopy
hub / github.com/django/django / test_save_continue_editing_button

Method test_save_continue_editing_button

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

Source from the content-addressed store, hash-verified

8067 self.assertTrue(new_user.has_usable_password())
8068
8069 def test_save_continue_editing_button(self):
8070 user_count = User.objects.count()
8071 response = self.client.post(
8072 reverse("admin:auth_user_add"),
8073 {
8074 "username": "newuser",
8075 "password1": "newpassword",
8076 "password2": "newpassword",
8077 "_continue": "1",
8078 },
8079 )
8080 new_user = User.objects.get(username="newuser")
8081 new_user_url = reverse("admin:auth_user_change", args=(new_user.pk,))
8082 self.assertRedirects(response, new_user_url, fetch_redirect_response=False)
8083 self.assertEqual(User.objects.count(), user_count + 1)
8084 self.assertTrue(new_user.has_usable_password())
8085 response = self.client.get(new_user_url)
8086 self.assertContains(
8087 response,
8088 '<li class="success">The user “<a href="%s">'
8089 "%s</a>” was added successfully. You may edit it again below.</li>"
8090 % (new_user_url, new_user),
8091 html=True,
8092 )
8093
8094 def test_password_mismatch(self):
8095 response = self.client.post(

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected