89
89
token = self.get_email_validation_token(email)
90
90
self.assert_(token is not None, "No login token created")
91
newaccount_url = self.absolute_url(
92
response, '/token/%s/+newaccount' % token)
91
93
response = self.get(
92
self.absolute_url(response, '/token/%s/+newaccount' % token),
93
description="Get /token/[...]/+newaccount")
94
newaccount_url, description="Get /token/[...]/+newaccount")
95
96
# Complete the registration process.
96
97
displayname = self.lipsum.getSubject(2)
97
98
password = self.lipsum.getWord()
98
response = response.postForm(
100
'field.displayname': displayname,
101
'field.hide_email_addresses': 'on',
102
'field.password': password,
103
'field.password_dupe': password,
104
'field.actions.continue': 'Continue'},
105
"Post /token/[...]/+newaccount")
106
self.assertNoFormErrors(response)
99
params = response.extractForm(include_submit=True)
102
'field.displayname': displayname,
103
'field.hide_email_addresses': 'on',
104
'field.password': password,
105
'field.password_dupe': password,
106
'field.actions.continue': 'Continue'})
107
# At the moment, creating your account doesn't log you in
108
# immidiately so you might end up at a 403 page - Bug #400610
109
response = self.post(
110
newaccount_url, params, ok_codes=[200, 302,303,403],
111
description="Post /token/[...]/+newaccount")
112
# Keep hitting the /login link until it works.
113
while response.body.find('You are not logged in.') != -1:
114
login_url = self.absolute_url(response, '/login')
115
response = self.get(login_url, description="Get /login")
108
117
# Registration succeeded - should be on the order details page now.
109
118
self.assertEquals(response.get_base_url(), '/myrequest')