From 15ef6d7318c78165568d06620744e4215bddea1a Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 22 2016 17:00:32 +0000 Subject: Add unit-tests ensuring we can't submit an email already pending confirmation --- diff --git a/tests/test_pagure_flask_ui_app.py b/tests/test_pagure_flask_ui_app.py index 4715cf3..5ed275c 100644 --- a/tests/test_pagure_flask_ui_app.py +++ b/tests/test_pagure_flask_ui_app.py @@ -471,6 +471,17 @@ class PagureFlaskApptests(tests.Modeltests): self.assertEqual(output.data.count('bar@pingou.com'), 5) self.assertEqual(output.data.count('foobar@pingou.com'), 2) + # Email already pending + output = self.app.post( + '/settings/email/add', data=data, follow_redirects=True) + self.assertEqual(output.status_code, 200) + self.assertIn( + '
\n ' + 'Add new email', output.data) + self.assertIn( + '\n This email is already ' + 'pending confirmation', output.data) + # User already has this email data = { 'csrf_token': csrf_token, @@ -484,8 +495,8 @@ class PagureFlaskApptests(tests.Modeltests): self.assertIn( 'Invalid value, can't be any of: bar@pingou.com, ' 'foo@pingou.com. ', output.data) - self.assertEqual(output.data.count('foo@pingou.com'), 5) - self.assertEqual(output.data.count('bar@pingou.com'), 4) + self.assertEqual(output.data.count('foo@pingou.com'), 6) + self.assertEqual(output.data.count('bar@pingou.com'), 5) self.assertEqual(output.data.count('foobar@pingou.com'), 0) # Email registered by someone else