Esempio n. 1
0
    def test_to_cti(self):
        state = QueueMemberState()
        state.status = '123'
        result = {}
        expected_result = {
            'callstaken': '0',
            'paused': '0',
            'penalty': '0',
            'status': '123',
            'lastcall': '',
        }

        state._to_cti(result)

        self.assertEqual(result, expected_result)
Esempio n. 2
0
    def test_from_ami_queue_member_added(self):
        ami_event = {
            'Queue': 'foobar',
            'Location': 'SIP/abcdef',
            'MemberName': 'Agent/2',
            'Membership': 'dynamic',
            'Penalty': '1',
            'CallsTaken': '42',
            'LastCall': '1355154813',
            'Status': '1',
            'Paused': '1',
        }
        expected_state = QueueMemberState()
        expected_state.calls_taken = 42
        expected_state.interface = 'SIP/abcdef'
        expected_state.last_call = datetime.fromtimestamp(1355154813)
        expected_state.paused = True
        expected_state.penalty = 1
        expected_state.status = '1'

        state = QueueMemberState.from_ami_queue_member_added(ami_event)

        self.assertEqual(state, expected_state)