'Creates course action state entries with different states for the given action model class.
Creates both displayable (should_display=True) and non-displayable (should_display=False) entries.'

def init_course_action_states(self, action_class):

    def create_course_states(starting_course_num, ending_course_num, state, should_display=True):
        '\n                                                Creates    a    list    of    course    state    tuples    by    creating    unique    course    locators    with    course-numbers\n                                                from    starting_course_num    to    ending_course_num.\n                                                '
        CourseState = namedtuple('CourseState', 'course_key,    state,    should_display')
        return [CourseState(CourseLocator('org', 'course', ('run' + str(num))), state, should_display) for num in range(starting_course_num, ending_course_num)]
    NUM_COURSES_WITH_STATE1 = 3
    NUM_COURSES_WITH_STATE2 = 3
    NUM_COURSES_WITH_STATE3 = 3
    NUM_COURSES_NON_DISPLAYABLE = 3
    self.courses_with_state1 = create_course_states(0, NUM_COURSES_WITH_STATE1, 'state1')
    self.courses_with_state2 = create_course_states(NUM_COURSES_WITH_STATE1, (NUM_COURSES_WITH_STATE1 + NUM_COURSES_WITH_STATE2), 'state2')
    self.courses_with_state3 = create_course_states((NUM_COURSES_WITH_STATE1 + NUM_COURSES_WITH_STATE2), ((NUM_COURSES_WITH_STATE1 + NUM_COURSES_WITH_STATE2) + NUM_COURSES_WITH_STATE3), 'state3')
    self.course_actions_displayable_states = ((self.courses_with_state1 + self.courses_with_state2) + self.courses_with_state3)
    self.courses_with_state3_non_displayable = create_course_states(((NUM_COURSES_WITH_STATE1 + NUM_COURSES_WITH_STATE2) + NUM_COURSES_WITH_STATE3), (((NUM_COURSES_WITH_STATE1 + NUM_COURSES_WITH_STATE2) + NUM_COURSES_WITH_STATE3) + NUM_COURSES_NON_DISPLAYABLE), 'state3', should_display=False)
    for CourseState in (self.course_actions_displayable_states + self.courses_with_state3_non_displayable):
        action_class.objects.update_state(CourseState.course_key, CourseState.state, should_display=CourseState.should_display, allow_not_found=True)
