def setUp(self): make_topic_and_linked_content("_Test Topic 1", [{ "type": "Article", "name": "_Test Article 1" }]) make_topic_and_linked_content("_Test Topic 2", [{ "type": "Article", "name": "_Test Article 2" }]) make_course_and_linked_topic("_Test Course 1", ["_Test Topic 1", "_Test Topic 2"])
def setup_program(): topic_list = [course['topic'] for course in test_data['course']] for topic in topic_list[0]: make_topic_and_linked_content(topic['topic_name'], topic['content']) all_courses_list = [{'course': course['course_name'], 'topic': [topic['topic_name'] for topic in course['topic']]} for course in test_data['course']] # returns [{'course': 'Applied Math', 'topic': ['Trignometry', 'Geometry']}] for course in all_courses_list: make_course_and_linked_topic(course['course'], course['topic']) course_list = [course['course_name'] for course in test_data['course']] program = make_program_and_linked_courses( test_data['program_name'], course_list) return program