Beispiel #1
0
    def test_get_queue_timeout_call_following_transfer_at_hour_border(self):
        queue_logs = [
            # New call in queue2
            ('2015-05-06 11:59:52.991930', '1430927991.36', 'queue2', 'NONE',
             'ENTERQUEUE', '', '0612345678', '1', '', ''),
            ('2015-05-06 12:00:02.110492', '1430927991.36', 'queue2',
             'Agent/1002', 'CONNECT', '10', '1430927992.37', '9', '', ''),
            ('2015-05-06 12:00:10.804470', '1430927991.36', 'queue2',
             'Agent/1002', 'COMPLETECALLER', '10', '8', '1', '', ''),
            # Agent/1002 blind txfer the call to queue1
            ('2015-05-06 12:00:10.883332', '1430927991.36', 'queue1', 'NONE',
             'ENTERQUEUE', '', '0612345678', '1', '', ''),
            ('2015-05-06 12:00:25.887220', '1430927991.36', 'queue1',
             'Agent/1001', 'RINGNOANSWER', '15000', '', '', '', ''),
            ('2015-05-06 12:00:29.197769', '1430927991.36', 'queue1', 'NONE',
             'EXITWITHTIMEOUT', '1', '1', '20', '', ''),
        ]
        for queue_log in queue_logs:
            queue_log_dao.insert_entry(*queue_log)

        timeout_at_11_oclock = list(
            queue_log_dao.get_queue_timeout_call(
                self.session, datetime(2015, 5, 6, 11, tzinfo=UTC),
                datetime(2015, 5, 6, 11, 59, 59, 999999, tzinfo=UTC)))
        timeout_at_12_oclock = list(
            queue_log_dao.get_queue_timeout_call(
                self.session, datetime(2015, 5, 6, 12, tzinfo=UTC),
                datetime(2015, 5, 6, 12, 59, 59, 999999, tzinfo=UTC)))

        assert_that(timeout_at_11_oclock, empty())
        assert_that(timeout_at_12_oclock, has_length(1))
    def test_get_queue_abandoned_call_no_enterqueue(self):
        queue_logs = [
            ('2015-05-06 12:00:10', '1', 'queue1', 'NONE', 'ENTERQUEUE', '', '0612345678', '1', '', ''),
            ('2015-05-06 12:00:11', '1', 'queue1', 'NONE', 'ABANDON', '1', '1', '19', '', ''),
            ('2015-05-06 12:00:12', '2', 'queue1', 'NONE', 'ABANDON', '1', '1', '30', '', ''),
        ]
        for queue_log in queue_logs:
            queue_log_dao.insert_entry(*queue_log)

        abandoned_at_12_oclock = list(queue_log_dao.get_queue_abandoned_call(self.session, datetime(2015, 5, 6, 12), datetime(2015, 5, 6, 12, 59, 59, 999999)))

        assert_that(abandoned_at_12_oclock, has_length(1))
Beispiel #3
0
    def test_insert_entry(self):
        queue_log_dao.insert_entry('time', 'callid', 'queue', 'agent', 'event', '1', '2', '3', '4', '5')

        result = [r for r in self.session.query(QueueLog).all()][0]
        self.assertEqual(result.time, 'time')
        self.assertEqual(result.callid, 'callid')
        self.assertEqual(result.queuename, 'queue')
        self.assertEqual(result.agent, 'agent')
        self.assertEqual(result.event, 'event')
        self.assertEqual(result.data1, '1')
        self.assertEqual(result.data2, '2')
        self.assertEqual(result.data3, '3')
        self.assertEqual(result.data4, '4')
        self.assertEqual(result.data5, '5')
def insert_entries(entries):
    for entry in entries:
        queue_log_dao.insert_entry(
            entry['time'],
            entry['callid'],
            entry['queuename'],
            entry['agent'],
            entry['event'],
            entry['data1'],
            entry['data2'],
            entry['data3'],
            entry['data4'],
            entry['data5']
        )
Beispiel #5
0
    def test_insert_entry(self):
        queue_log_dao.insert_entry('time', 'callid', 'queue', 'agent', 'event',
                                   '1', '2', '3', '4', '5')

        result = [r for r in self.session.query(QueueLog).all()][0]
        self.assertEqual(result.time, 'time')
        self.assertEqual(result.callid, 'callid')
        self.assertEqual(result.queuename, 'queue')
        self.assertEqual(result.agent, 'agent')
        self.assertEqual(result.event, 'event')
        self.assertEqual(result.data1, '1')
        self.assertEqual(result.data2, '2')
        self.assertEqual(result.data3, '3')
        self.assertEqual(result.data4, '4')
        self.assertEqual(result.data5, '5')
Beispiel #6
0
    def test_get_queue_abandoned_call_no_enterqueue(self):
        queue_logs = [
            ('2015-05-06 12:00:10', '1', 'queue1', 'NONE', 'ENTERQUEUE', '',
             '0612345678', '1', '', ''),
            ('2015-05-06 12:00:11', '1', 'queue1', 'NONE', 'ABANDON', '1', '1',
             '19', '', ''),
            ('2015-05-06 12:00:12', '2', 'queue1', 'NONE', 'ABANDON', '1', '1',
             '30', '', ''),
        ]
        for queue_log in queue_logs:
            queue_log_dao.insert_entry(*queue_log)

        abandoned_at_12_oclock = list(
            queue_log_dao.get_queue_abandoned_call(
                self.session, datetime(2015, 5, 6, 12, tzinfo=UTC),
                datetime(2015, 5, 6, 12, 59, 59, 999999, tzinfo=UTC)))

        assert_that(abandoned_at_12_oclock, has_length(1))
    def test_get_queue_timeout_call_following_transfer_at_hour_border(self):
        queue_logs = [
            # New call in queue2
            ('2015-05-06 11:59:52.991930', '1430927991.36', 'queue2', 'NONE', 'ENTERQUEUE', '', '0612345678', '1', '', ''),
            ('2015-05-06 12:00:02.110492', '1430927991.36', 'queue2', 'Agent/1002', 'CONNECT', '10', '1430927992.37', '9', '', ''),
            ('2015-05-06 12:00:10.804470', '1430927991.36', 'queue2', 'Agent/1002', 'COMPLETECALLER', '10', '8', '1', '', ''),
            # Agent/1002 blind txfer the call to queue1
            ('2015-05-06 12:00:10.883332', '1430927991.36', 'queue1', 'NONE', 'ENTERQUEUE', '', '0612345678', '1', '', ''),
            ('2015-05-06 12:00:25.887220', '1430927991.36', 'queue1', 'Agent/1001', 'RINGNOANSWER', '15000', '', '', '', ''),
            ('2015-05-06 12:00:29.197769', '1430927991.36', 'queue1', 'NONE', 'EXITWITHTIMEOUT', '1', '1', '20', '', ''),
        ]
        for queue_log in queue_logs:
            queue_log_dao.insert_entry(*queue_log)

        timeout_at_11_oclock = list(queue_log_dao.get_queue_timeout_call(self.session, datetime(2015, 5, 6, 11), datetime(2015, 5, 6, 11, 59, 59, 999999)))
        timeout_at_12_oclock = list(queue_log_dao.get_queue_timeout_call(self.session, datetime(2015, 5, 6, 12), datetime(2015, 5, 6, 12, 59, 59, 999999)))

        assert_that(timeout_at_11_oclock, empty())
        assert_that(timeout_at_12_oclock, has_length(1))
Beispiel #8
0
 def _insert_at(t):
     queue_log_dao.insert_entry(t, 'hours', 'queue', 'agent', 'event')
Beispiel #9
0
 def _insert_at(t):
     queue_log_dao.insert_entry(t, 'hours', 'queue', 'agent', 'event')