def test_edit_alert(self): """Can we edit the alert and see the message about it being edited?""" user = User.objects.get(username='******') alert = Alert( user=user, name=self.alert_params['name'], query=self.alert_params['query'], rate=self.alert_params['rate'], ) alert.save() # Pan tries to edit their alert self.browser.get( '{url}{path}?{q}&edit_alert={pk}'.format( url=self.server_url, path=reverse('show_results'), q=alert.query, pk=alert.pk, )) # But winds up at the sign in form self.assertIn(reverse('sign-in'), self.browser.current_url) # So Pan signs in. self.browser.find_element_by_id('username').send_keys('pandora') self.browser.find_element_by_id('password').send_keys('password' + '\n') # And gets redirected to the SERP where they see a notice about their # alert being edited. self.assert_text_in_body("editing your alert")
def test_edit_alert(self) -> None: """Can we edit the alert and see the message about it being edited?""" user = User.objects.get(username="******") alert = Alert( user=user, name=self.alert_params["name"], query=self.alert_params["query"], rate=self.alert_params["rate"], ) alert.save() # Pan tries to edit their alert url = "{url}{path}?{q}&edit_alert={pk}".format( url=self.live_server_url, path=reverse("show_results"), q=alert.query, pk=alert.pk, ) self.browser.get(url) # But winds up at the sign in form self.assertIn(reverse("sign-in"), self.browser.current_url) # So Pan signs in. self.browser.find_element(By.ID, "username").send_keys("pandora") self.browser.find_element(By.ID, "password").send_keys("password") self.browser.find_element(By.ID, "password").submit() # And gets redirected to the SERP where they see a notice about their # alert being edited. self.assert_text_in_node("editing your alert", "body")