'Create students, a problem, and StudentModule objects for testing'

def _create_students_with_state(self, num_students, state=None, grade=0, max_grade=1):

    self.define_option_problem(PROBLEM_URL_NAME)
    students = [UserFactory.create(username=('robot%d' % i), email=('robot+test+%d@edx.org' % i)) for i in xrange(num_students)]
    for student in students:
        CourseEnrollmentFactory.create(course_id=self.course.id, user=student)
        StudentModuleFactory.create(course_id=self.course.id, module_state_key=self.location, student=student, grade=grade, max_grade=max_grade, state=state)
    return students
