'Make sure a user requests do not exceed the maximum number of requests'

def test_enrollment_throttle_for_user(self):

    self.rate_limit_config.enabled = True
    self.rate_limit_config.save()
    CourseModeFactory.create(course_id=self.course.id, mode_slug=CourseMode.DEFAULT_MODE_SLUG, mode_display_name=CourseMode.DEFAULT_MODE_SLUG)
    for attempt in xrange((self.rate_limit + 10)):
        expected_status = (status.HTTP_429_TOO_MANY_REQUESTS if (attempt >= self.rate_limit) else status.HTTP_200_OK)
        self.assert_enrollment_status(expected_status=expected_status)
