MCPcopy
hub / github.com/django/django / test_cancel_delete_confirmation

Method test_cancel_delete_confirmation

tests/admin_views/tests.py:6793–6810  ·  view source on GitHub ↗

Cancelling the deletion of an object takes the user back one page.

(self)

Source from the content-addressed store, hash-verified

6791 self.take_screenshot("focus-multi-widget")
6792
6793 def test_cancel_delete_confirmation(self):
6794 "Cancelling the deletion of an object takes the user back one page."
6795 from selenium.webdriver.common.by import By
6796
6797 pizza = Pizza.objects.create(name="Double Cheese")
6798 url = reverse("admin:admin_views_pizza_change", args=(pizza.id,))
6799 full_url = self.live_server_url + url
6800 self.admin_login(
6801 username="super", password="secret", login_url=reverse("admin:index")
6802 )
6803 self.selenium.get(full_url)
6804 self.selenium.find_element(By.CLASS_NAME, "deletelink").click()
6805 # Click 'cancel' on the delete page.
6806 self.selenium.find_element(By.CLASS_NAME, "cancel-link").click()
6807 # Wait until we're back on the change page.
6808 self.wait_for_text("#content h1", "Change pizza")
6809 self.assertEqual(self.selenium.current_url, full_url)
6810 self.assertEqual(Pizza.objects.count(), 1)
6811
6812 def test_cancel_delete_related_confirmation(self):
6813 """

Callers

nothing calls this directly

Calls 6

reverseFunction · 0.90
admin_loginMethod · 0.80
wait_for_textMethod · 0.80
createMethod · 0.45
getMethod · 0.45
countMethod · 0.45

Tested by

no test coverage detected