Example #1
0
def clean_db():
    with session_scope() as dao_sess:
        stat_call_on_queue_dao.clean_table(dao_sess)
        stat_agent_periodic_dao.clean_table(dao_sess)
        stat_queue_periodic_dao.clean_table(dao_sess)
        stat_agent_dao.clean_table(dao_sess)
        stat_queue_dao.clean_table(dao_sess)
    def test_clean_table(self):
        start = datetime.datetime(2012, 01, 01, 00, 00, 00)

        queue_name, _ = self._insert_queue_to_stat_queue()

        for minute_increment in [-5, 5, 15, 22, 35, 65, 120]:
            delta = datetime.timedelta(minutes=minute_increment)
            time = start + delta
            stat_call_on_queue_dao.add_full_call(self.session, 'callid%s' % minute_increment, time, queue_name)

        stat_call_on_queue_dao.clean_table(self.session)

        total = (self.session.query(func.count(StatCallOnQueue.callid))).first()[0]

        self.assertEqual(total, 0)
Example #3
0
def clean_db():
    stat_call_on_queue_dao.clean_table(dao_sess)
    stat_agent_periodic_dao.clean_table(dao_sess)
    stat_queue_periodic_dao.clean_table(dao_sess)
    stat_agent_dao.clean_table(dao_sess)
    stat_queue_dao.clean_table(dao_sess)