From 728eb18e52ca8d6de284904ee45fd2ca3ab2f3dc Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Aug 14 2015 21:19:49 +0000 Subject: Improve the unit-tests for the add_user endpoint --- diff --git a/tests/test_progit_flask_ui_repo.py b/tests/test_progit_flask_ui_repo.py index f329f67..bfe9d99 100644 --- a/tests/test_progit_flask_ui_repo.py +++ b/tests/test_progit_flask_ui_repo.py @@ -75,6 +75,17 @@ class PagureFlaskRepotests(tests.Modeltests): ast.return_value = True output = self.app.get('/test/adduser') self.assertEqual(output.status_code, 302) + + # Redirect also happens for POST request + output = self.app.post('/test/adduser') + self.assertEqual(output.status_code, 302) + # Check the message flashed during the redirect + output = self.app.get('/') + self.assertEqual(output.status_code, 200) + self.assertIn( + '
  • Action canceled, try it again
  • ', + output.data) + ast.return_value = False user.username = 'pingou'