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
parent faa43ec2e3
commit 9383b5aa74

View file

@ -2296,13 +2296,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"),
@ -2311,13 +2311,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"),