'Helper method to consolidate some courseware/proctoring/credit
test harness data'

def _setup_test_data(self, enrollment_mode, is_practice_exam, attempt_status):

    usage_key = self.course_key.make_usage_key('videosequence', 'Toy_Videos')
    sequence = self.modulestore.get_item(usage_key)
    sequence.is_time_limited = True
    sequence.is_proctored_exam = True
    sequence.is_practice_exam = is_practice_exam
    self.modulestore.update_item(sequence, self.user.id)
    self.toy_course = self.modulestore.get_course(self.course_key)
    self.field_data_cache = FieldDataCache.cache_for_descriptor_descendents(self.course_key, self.request.user, self.toy_course, depth=2)
    set_runtime_service('credit', MockCreditService(enrollment_mode=enrollment_mode))
    exam_id = create_exam(course_id=unicode(self.course_key), content_id=unicode(sequence.location), exam_name='foo', time_limit_mins=10, is_proctored=True, is_practice_exam=is_practice_exam)
    if attempt_status:
        create_exam_attempt(exam_id, self.request.user.id, taking_as_proctored=True)
        update_attempt_status(exam_id, self.request.user.id, attempt_status)
    return usage_key
