Ejemplo n.º 1
0
    def test_copy(self):
        state1 = QueueMemberState()
        state1.calls_taken = 42

        state2 = state1.copy()
        state2.interface = 'Local/423232@foobar'

        self.assertEqual(state1.calls_taken, state2.calls_taken)
        self.assertNotEqual(state1.interface, state2.interface)
        self.assertTrue(state1.__dict__ is not state2.__dict__)
Ejemplo 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)