You could just do:

    course = CourseFactory.create()
    self.course_id = course.course_id

or even `self.course_id = CourseFactory.create().course_id`