Merge lp:~james-w/canonical-identity-provider/doubled-email-acceptance into lp:canonical-identity-provider/release

Proposed by James Westby
Status: Merged
Approved by: Natalia Bidart
Approved revision: no longer in the source branch.
Merged at revision: 1034
Proposed branch: lp:~james-w/canonical-identity-provider/doubled-email-acceptance
Merge into: lp:canonical-identity-provider/release
Diff against target: 73 lines (+16/-30)
2 files modified
acceptance/pages.py (+8/-0)
acceptance/tests/emails/doubled_email.py (+8/-30)
To merge this branch: bzr merge lp:~james-w/canonical-identity-provider/doubled-email-acceptance
Reviewer Review Type Date Requested Status
Natalia Bidart (community) Approve
Review via email: mp+182508@code.launchpad.net

Commit message

When a second user tries to add an email that is already in use they get an error.

The behaviour changed in r1031 such that you can't claim an email that has been
added by someone else, even if they haven't yet verified it. This updates
the acceptance test to check this, rather than checking the rules around token
invalidation with duplicated emails.

Description of the change

Hi,

This updates the failing acceptence test to match the new behaviour
of duplicated emails.

Thanks,

James

To post a comment you must log in.
Revision history for this message
Natalia Bidart (nataliabidart) wrote :

Looks good!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'acceptance/pages.py'
--- acceptance/pages.py 2013-07-12 15:57:28 +0000
+++ acceptance/pages.py 2013-08-27 21:48:48 +0000
@@ -203,6 +203,14 @@
203 sst.actions.click_link(remove_link)203 sst.actions.click_link(remove_link)
204 return DeleteEmail()204 return DeleteEmail()
205205
206 def get_form_errors(self):
207 try:
208 email_error = sst.actions.get_element(
209 css_class='error').text
210 except AssertionError:
211 email_error = None
212 return email_error
213
206214
207class EnterConfirmationCode(LoggedUserPage):215class EnterConfirmationCode(LoggedUserPage):
208216
209217
=== modified file 'acceptance/tests/emails/doubled_email.py'
--- acceptance/tests/emails/doubled_email.py 2013-05-02 17:20:14 +0000
+++ acceptance/tests/emails/doubled_email.py 2013-08-27 21:48:48 +0000
@@ -1,12 +1,10 @@
1from sst.actions import (1from sst.actions import (
2 assert_title,2 assert_equal,
3 fails,
4 wait_for,
5)3)
6from u1testutils import mail4from u1testutils import mail
7from u1testutils.sst import config5from u1testutils.sst import config
86
9from acceptance import helpers7from acceptance import helpers, pages
108
11config.set_base_url_from_env()9config.set_base_url_from_env()
12PASSWORD = 'Admin007'10PASSWORD = 'Admin007'
@@ -23,29 +21,9 @@
23helpers.logout()21helpers.logout()
2422
25helpers.register_account(email_b_id, password=PASSWORD)23helpers.register_account(email_b_id, password=PASSWORD)
26vcode_y = helpers.add_email(email_c_id)24# Once one account adds an email, no-one else can add it, even if
2725# it is not yet verified.
2826your_email_addresses = pages.YourEmailAddresses(open_page=True)
29# try x from a, should fail27your_email_addresses.add_email(email_c_id)
30helpers.logout()28assert_equal('Email already registered.',
31helpers.login(email_a_id, PASSWORD)29 your_email_addresses.get_form_errors())
32# Trying and failing to use token X completely invalidates token X, even for
33# account B (which now owns the token) later in this test.
34# helpers.try_to_validate_email(email_c_id, vcode_x)
35# fails(assert_title, 'Complete email address validation')
36
37# try y from a, should fail
38helpers.try_to_validate_email(email_c_id, vcode_y, finish_validation=False)
39fails(assert_title, 'Complete email address validation')
40
41# both x & y should work for b, but using one should kill the other.
42# try x from b, should work
43helpers.logout()
44helpers.login(email_b_id, PASSWORD)
45helpers.try_to_validate_email(email_c_id, vcode_x, finish_validation=False)
46wait_for(assert_title, 'Complete email address validation')
47
48# now, y from b should fail, because address C was already verified (but would
49# normally work)
50helpers.try_to_validate_email(email_c_id, vcode_y, finish_validation=False)
51fails(assert_title, 'Complete email address validation')