Пример #1
0
    def test_not_done(self):
        sessions = []
        for session in self.sessions:
            session.publish_date = dateutil.parser.parse("2015-09-21")
            sessions.append(session)

        sessions.append(mocks.MockSession(publish_date=dateutil.parser.parse("2015-09-22")))
        main.check_warnings(self.configuration, sessions, self.sessions)
        self.assertEqual(len(self.append_warning_code_list), 0)

        sessions.append(mocks.MockSession(publish_date=dateutil.parser.parse("2015-09-22")))
        main.check_warnings(self.configuration, sessions, self.sessions)
        self.assertEqual(len(self.append_warning_code_list), 1)
        self.assertEqual(self.append_warning_code_list[0], "S-1.1")
Пример #2
0
    def test_avg_low_mot(self):
        # self.get_filtered_times_value = (0, 0)
        self.get_percentile_value = 10
        self.sessions[-1].status_begin = 0
        self.sessions[-2].status_begin = 0
        main.check_warnings(self.configuration, [], self.sessions)
        self.assertEqual(len(self.append_warning_code_list), 1)
        self.assertEqual(self.append_warning_code_list[0], "MOT-1.1")

        self.sessions[-1].status_begin = 4
        self.sessions[-2].status_begin = 4
        self.append_warning_code_list = []
        main.check_warnings(self.configuration, [], self.sessions)
        self.assertEqual(len(self.append_warning_code_list), 1)
        self.assertEqual(self.append_warning_code_list[0], "MOT-1.4")

        self.sessions[-1].status_begin = 4
        self.sessions[-2].status_begin = 5
        self.append_warning_code_list = []
        main.check_warnings(self.configuration, [], self.sessions)
        self.assertEqual(len(self.append_warning_code_list), 1)
        self.assertEqual(self.append_warning_code_list[0], "MOT-1.3")

        self.sessions[-1].status_begin = 6
        self.sessions[-2].status_begin = 6
        self.sessions[-3].status_begin = 5
        self.sessions[-4].status_begin = 6
        self.append_warning_code_list = []

        main.check_warnings(self.configuration, [], self.sessions)
        self.assertEqual(len(self.append_warning_code_list), 1)
        self.assertEqual(self.append_warning_code_list[0], "MOT-1.2")
Пример #3
0
    def test_time(self):
        self.sessions[-1].completed_time = dateutil.parser.parse("2015-09-30 20:59:59+02:00")
        main.check_warnings(self.configuration, [], self.sessions)
        self.assertEqual(len(self.append_warning_code_list), 0)

        self.sessions[-1].completed_time = dateutil.parser.parse("2015-09-30 21:00:01+02:00")
        main.check_warnings(self.configuration, [], self.sessions)
        self.assertEqual(len(self.append_warning_code_list), 1)
        self.assertEqual(self.append_warning_code_list[0], "H-1.1")

        self.append_warning_code_list = []
        self.sessions[-1].completed_time = dateutil.parser.parse("2015-09-30 06:59:59+02:00")
        main.check_warnings(self.configuration, [], self.sessions)
        self.assertEqual(len(self.append_warning_code_list), 1)
        self.assertEqual(self.append_warning_code_list[0], "H-1.1")

        self.append_warning_code_list = []
        self.sessions[-1].completed_time = dateutil.parser.parse("2015-09-30 07:00:00+02:00")
        main.check_warnings(self.configuration, [], self.sessions)
        self.assertEqual(len(self.append_warning_code_list), 0)
Пример #4
0
    def test_filtered_times(self):
        self.get_filtered_times_value = (1, 0)
        main.check_warnings(self.configuration, [], self.sessions)
        self.assertEqual(len(self.append_warning_code_list), 1)
        self.assertEqual(self.append_warning_code_list[0], "CL-1.3")

        self.append_warning_code_list = []
        self.get_filtered_times_value = (3, 0)
        main.check_warnings(self.configuration, [], self.sessions)
        self.assertEqual(len(self.append_warning_code_list), 1)
        self.assertEqual(self.append_warning_code_list[0], "CL-1.2")

        self.append_warning_code_list = []
        self.get_filtered_times_value = (3, 0)
        self.sessions[-1].status_end = int(self.sessions[-1].status_begin) - 4
        main.check_warnings(self.configuration, [], self.sessions)
        self.assertEqual(len(self.append_warning_code_list), 2)
        self.assertEqual(self.append_warning_code_list[1], "CL-1.1")
Пример #5
0
    def test_mot_difference(self):
        # self.get_filtered_times_value = (0, 0)
        self.sessions[-1].status_end = int(self.sessions[-1].status_begin) - 1
        main.check_warnings(self.configuration, [], self.sessions)
        self.assertEqual(len(self.append_warning_code_list), 1)
        self.assertEqual(self.append_warning_code_list[0], "MOT-3.3")

        self.append_warning_code_list = []
        self.sessions[-1].status_end = int(self.sessions[-1].status_begin) - 4
        main.check_warnings(self.configuration, [], self.sessions)
        self.assertEqual(len(self.append_warning_code_list), 1)
        self.assertEqual(self.append_warning_code_list[0], "MOT-3.2")

        self.append_warning_code_list = []
        self.sessions[-1].status_end = int(self.sessions[-1].status_begin) - 4
        self.sessions[-2].status_end = int(self.sessions[-2].status_begin) - 4
        self.sessions[-3].status_end = int(self.sessions[-3].status_begin) - 5
        main.check_warnings(self.configuration, [], self.sessions)
        self.assertEqual(len(self.append_warning_code_list), 1)
        self.assertEqual(self.append_warning_code_list[0], "MOT-3.1")
Пример #6
0
 def test_percentile(self):
     self.get_percentile_value = 3
     self.sessions[-1].difficulty = 3
     main.check_warnings(self.configuration, [], self.sessions)
     self.assertEqual(len(self.append_warning_code_list), 1)
     self.assertEqual(self.append_warning_code_list[0], "CL-2.1")