def test_calculate_course_run_key_run_value_with_multiple_runs_per_trimester(self): start = datetime.datetime(2017, 2, 1) CourseRunFactory(key='course-v1:TestX+Testing101x+1T2017') assert StudioAPI.calculate_course_run_key_run_value('TestX', start) == '1T2017a' CourseRunFactory(key='course-v1:TestX+Testing101x+1T2017a') assert StudioAPI.calculate_course_run_key_run_value('TestX', start) == '1T2017b'
def assert_data_generated_correctly(self, course_run, expected_team_data, creating=False): course = course_run.course expected = { 'title': course_run.title_override or course.title, 'org': course.organizations.first().key, 'number': course.number, 'run': StudioAPI.calculate_course_run_key_run_value( course.number, course_run.start_date_temporary), 'schedule': { 'start': serialize_datetime(course_run.start_date_temporary), 'end': serialize_datetime(course_run.end_date_temporary), }, 'team': expected_team_data, 'pacing_type': course_run.pacing_type_temporary, } assert StudioAPI.generate_data_for_studio_api( course_run, creating=creating) == expected
def test_calculate_course_run_key_run_value(self, month, expected): start = datetime.datetime(2017, month, 1) assert StudioAPI.calculate_course_run_key_run_value( 'NONE', start=start) == expected