~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to benchmarks/test_shipit.py

  • Committer: Stuart Bishop
  • Date: 2009-07-17 10:55:55 UTC
  • mto: This revision was merged to the branch mainline in revision 8958.
  • Revision ID: stuart.bishop@canonical.com-20090717105555-14z928bwbzclaixl
Cope with Bug #400610

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
        # validate it.
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")
94
95
 
95
96
        # Complete the registration process.
96
97
        displayname = self.lipsum.getSubject(2)
97
98
        password = self.lipsum.getWord()
98
 
        response = response.postForm(
99
 
            0, self.post, {
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)
 
100
 
 
101
        params.update({
 
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")
107
116
 
108
117
        # Registration succeeded - should be on the order details page now.
109
118
        self.assertEquals(response.get_base_url(), '/myrequest')