Example #1
0
 def test_get_total_number_of_courses_with_nine_courses(self):
     xml_string = get_string("fixtures/one_inst_nine_courses.xml")
     root = ET.fromstring(xml_string)
     institution = get_first(root.iter("INSTITUTION"))
     expected_number_of_courses = 9
     number_of_courses = get_total_number_of_courses(institution)
     self.assertEqual(expected_number_of_courses, number_of_courses)
Example #2
0
 def test_get_student_unions_one_course(self):
     kis_xml_string = get_string("fixtures/large_test_file.xml")
     inst_xml_string = get_string("fixtures/one_inst_one_course.xml")
     kis_root = ET.fromstring(kis_xml_string)
     locations = Locations(kis_root)
     inst_root = ET.fromstring(inst_xml_string)
     institution = get_first(inst_root.iter("INSTITUTION"))
     get_student_unions(locations, institution)
Example #3
0
 def test_get_institution_doc(self):
     xml_string = get_string("fixtures/one_inst_one_course.xml")
     root = ET.fromstring(xml_string)
     institution = get_first(root.iter("INSTITUTION"))
     expected_resp = json.loads(
         get_string("fixtures/one_inst_one_course.json"))
     expected_resp = remove_variable_elements(expected_resp)
     resp = self.institution_docs.get_institution_doc(institution)
     resp = remove_variable_elements(resp)
     self.assertEqual(expected_resp, resp)
Example #4
0
    def test_get_student_unions_413_courses(self):

        # Build a locations lookup
        kis_xml_string = get_string("fixtures/large_test_file.xml")
        kis_root = ET.fromstring(kis_xml_string)
        location_lookup = Locations(kis_root)

        # Get an institution so we can pass it to get_student_unions
        institution_xml_string = get_string(
            "fixtures/one_inst_413_courses.xml")
        institution_root = ET.fromstring(institution_xml_string)
        institution = get_first(institution_root.iter("INSTITUTION"))

        student_unions = get_student_unions(location_lookup, institution)
        expected_student_unions = json.loads(
            get_string("fixtures/one_inst_413_courses.json"))
        self.assertEqual(expected_student_unions, student_unions)