Exemplo n.º 1
0
 def test_with_large_file(self):
     """Initial smoke test"""
     print("test with large file")
     xml_string = get_string("fixtures/large-test-file.xml")
     root = ET.fromstring(xml_string)
     for institution in root.iter("INSTITUTION"):
         for course in institution.findall("KISCOURSE"):
             raw_course_data = xmltodict.parse(ET.tostring(course))[
                 "KISCOURSE"
             ]
             job_list = JobList()
             job_list.get_stats(raw_course_data)
Exemplo n.º 2
0
class TestGetStats(unittest.TestCase):
    def setUp(self):
        self.job_list = JobList()

    def test_with_large_file(self):
        """Initial smoke test"""
        print("test with large file")
        xml_string = get_string("fixtures/large-test-file.xml")
        root = ET.fromstring(xml_string)
        for institution in root.iter("INSTITUTION"):
            for course in institution.findall("KISCOURSE"):
                raw_course_data = xmltodict.parse(ET.tostring(course))[
                    "KISCOURSE"
                ]
                job_list = JobList()
                job_list.get_stats(raw_course_data)

    def test_no_subj(self):
        raw_course_xml = xmltodict.parse(
            get_string("fixtures/course_no_subj_for_most.xml")
        )["KISCOURSE"]
        expected_result = json.loads(
            get_string("fixtures/course_no_com_subj_resp.json")
        )
        json_obj = self.job_list.get_stats(raw_course_xml)
        self.assertListEqual(json_obj, expected_result)

    def test_with_subj(self):
        raw_course_xml = xmltodict.parse(
            get_string("fixtures/course_with_subj_for_most.xml")
        )["KISCOURSE"]
        json_obj = self.job_list.get_stats(raw_course_xml)
        expected_result = json.loads(
            get_string("fixtures/job_list_with_subj.json")
        )
        self.assertListEqual(json_obj, expected_result)

    def test_three_commons(self):
        raw_course_xml = xmltodict.parse(
            get_string("fixtures/course_three_commons.xml")
        )["KISCOURSE"]
        json_obj = self.job_list.get_stats(raw_course_xml)
        expected_result = json.loads(
            get_string("fixtures/course_three_commons.json")
        )
        self.assertListEqual(json_obj, expected_result)
Exemplo n.º 3
0
 def setUp(self):
     self.job_list = JobList()
Exemplo n.º 4
0
 def setUp(self):
     self.job_list = JobList()
     self.lookup = self.job_list.data_fields_lookup