Esempio n. 1
0
    def test_from_dao_queue_member(self):
        dao_queue_member = Mock()
        dao_queue_member.penalty = 1
        expected_state = QueueMemberState()
        expected_state.penalty = 1

        state = QueueMemberState.from_dao_queue_member(dao_queue_member)

        self.assertEqual(state, expected_state)
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)