'Create dummy course with \'CourseFactory\' and enroll the student'

def _create_course_with_access_groups(self, course_location, metadata=None, default_store=None):

    metadata = ({} if (not metadata) else metadata)
    course = CourseFactory.create(org=course_location.org, number=course_location.course, run=course_location.run, metadata=metadata, default_store=default_store)
    CourseEnrollment.enroll(self.student, course.id)
    return course
