def fill_simple_calls(dao_sess, start, end): logger.info('Inserting simple calls...') stat_dao.fill_simple_calls(dao_sess, start, end) logger.info('Inserting answered calls...') stat_dao.fill_answered_calls(dao_sess, start, end) logger.info('Inserting leaveempty calls...') stat_dao.fill_leaveempty_calls(dao_sess, start, end)
def test_empty(self): start = t(1999, 1, 1) end = t(1999, 1, 31, 23, 59, 59, 999999) try: stat_dao.fill_simple_calls(self.session, start, end) except Exception: self.fail('fill_simple_calls failed with no data')
def test_with_specific_range(self): start = t(2020, 1, 1) end = t(2020, 1, 31, 23, 59, 59, 999999) stat_dao.fill_simple_calls(self.session, start, end) result = self.session.query(StatCallOnQueue).all() assert_that(result, contains(has_properties(status='full')))
def test_with_specific_timezone(self): # Asia/Shanghai is +08 start = t(2020, 1, 1, 1, 0, 0, 0, tzinfo=pytz.timezone('Asia/Shanghai')) end = t(2020, 1, 31, 23, 59, 59, 999999) stat_dao.fill_simple_calls(self.session, start, end) result = self.session.query(StatCallOnQueue).all() assert_that(result, contains(has_properties(status='full')))
def test_fill_simple_calls_empty(self): try: stat_dao.fill_simple_calls(self.session, self.start, self.end) except: self.assertTrue(False, 'Should not happen')
def test_fill_simple_calls_empty(self): try: stat_dao.fill_simple_calls(self.session, self.start, self.end) except Exception: self.fail('fill_simple_calls failed with no data')