'Try (and fail) resetting password 30 times in a row on an non-existant email address'

@patch('student.views.render_to_string', Mock(side_effect=mock_render_to_string, autospec=True))
def test_password_reset_ratelimited(self):

    cache.clear()
    for i in xrange(30):
        good_req = self.request_factory.post('/password_reset/', {'email': 'thisdoesnotexist{0}@foo.com'.format(i)})
        good_resp = password_reset(good_req)
        self.assertEquals(good_resp.status_code, 200)
    bad_req = self.request_factory.post('/password_reset/', {'email': 'thisdoesnotexist@foo.com'})
    bad_resp = password_reset(bad_req)
    self.assertEquals(bad_resp.status_code, 403)
    self.assert_no_events_were_emitted()
    cache.clear()
