~stephen-stewart/canonical-identity-provider/2fa-css-counters

« back to all changes in this revision

Viewing changes to src/api/v20/tests/test_registration.py

  • Committer: Tarmac
  • Author(s): James Westby
  • Date: 2013-08-26 13:43:58 UTC
  • mfrom: (1026.1.7 captcha-timeline)
  • Revision ID: tarmac-20130826134358-vzlxsinnlzgggeol
[r=ricardokirkner] Add entries to the request timeline when creating or verifying a captcha.

These http requests made during a request can take time, so record them
in the timeline. That way if there is a slow request involving one you
can see how long it took.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
from mock import (
 
2
    ANY,
2
3
    patch,
3
4
    call as mock_call,
4
5
)
177
178
 
178
179
        self.assertEqual(response.status_code, 201)
179
180
        expected_calls = mock_call('999').verify(
180
 
            'foo bar', '127.0.0.1', self.data['email']).call_list()
 
181
            'foo bar', '127.0.0.1', self.data['email'], timer=ANY).call_list()
181
182
        self.assertEqual(mock_captcha.mock_calls, expected_calls)
182
183
 
183
184
        self.assertIn('openid', json_body)
197
198
        response, json_body = call(self.handler.create, self.url, self.data)
198
199
        self.assertEqual(response.status_code, 403)
199
200
        expected_calls = mock_call('999').verify(
200
 
            'foo bar', '127.0.0.1', self.data['email']).call_list()
 
201
            'foo bar', '127.0.0.1', self.data['email'], timer=ANY).call_list()
201
202
        self.assertEqual(mock_captcha.mock_calls, expected_calls)
202
203
 
203
204
        self.assertEqual(json_body['code'], "CAPTCHA_FAILURE")