tests: follow_redirects is now the default for post_project

This commit is contained in:
Baptiste Jonglez 2020-05-19 19:31:42 +02:00 committed by zorun
parent 381ea8fe0c
commit 8d9dc6a61f

View file

@ -1641,13 +1641,13 @@ class EmailFailureTestCase(IhatemoneyTestCase):
with patch.object( with patch.object(
self.app.mail, "send", MagicMock(side_effect=smtplib.SMTPException) self.app.mail, "send", MagicMock(side_effect=smtplib.SMTPException)
): ):
resp = self.post_project("raclette", follow_redirects=True) resp = self.post_project("raclette")
# Check that an error message is displayed # Check that an error message is displayed
self.assertIn( self.assertIn(
"We tried to send you an reminder email, but there was an error", "We tried to send you an reminder email, but there was an error",
resp.data.decode("utf-8"), resp.data.decode("utf-8"),
) )
# Check that we are redirected anyway # Check that we were redirected to the home page anyway
self.assertIn( self.assertIn(
'You probably want to <a href="/raclette/members/add"', 'You probably want to <a href="/raclette/members/add"',
resp.data.decode("utf-8"), resp.data.decode("utf-8"),
@ -1656,13 +1656,13 @@ class EmailFailureTestCase(IhatemoneyTestCase):
def test_creation_email_failure_socket(self): def test_creation_email_failure_socket(self):
self.login("raclette") self.login("raclette")
with patch.object(self.app.mail, "send", MagicMock(side_effect=socket.error)): with patch.object(self.app.mail, "send", MagicMock(side_effect=socket.error)):
resp = self.post_project("raclette", follow_redirects=True) resp = self.post_project("raclette")
# Check that an error message is displayed # Check that an error message is displayed
self.assertIn( self.assertIn(
"We tried to send you an reminder email, but there was an error", "We tried to send you an reminder email, but there was an error",
resp.data.decode("utf-8"), resp.data.decode("utf-8"),
) )
# Check that we are redirected anyway # Check that we were redirected to the home page anyway
self.assertIn( self.assertIn(
'You probably want to <a href="/raclette/members/add"', 'You probably want to <a href="/raclette/members/add"',
resp.data.decode("utf-8"), resp.data.decode("utf-8"),