def test_add_agent_to_queue_two_agents(self): agent1 = self.add_agent() self._insert_agent_login_status(agent1.id, agent1.number) agent2 = self.add_agent() self._insert_agent_login_status(agent2.id, agent2.number, '1002', 'default', interface='Local/2@foo', state_interface='SIP/defabc') queues = [ agent_status_dao._Queue(1, 'queue1', 0), agent_status_dao._Queue(2, 'queue2', 0), ] agent_status_dao.add_agent_to_queues(agent1.id, queues) agent_status_dao.add_agent_to_queues(agent2.id, queues) agent1_status = agent_status_dao.get_status(agent1.id) agent2_status = agent_status_dao.get_status(agent2.id) assert_that( agent1_status, has_properties(queues=contains( has_properties(id=1, name='queue1'), has_properties(id=2, name='queue2'), ))) assert_that( agent2_status, has_properties(queues=contains( has_properties(id=1, name='queue1'), has_properties(id=2, name='queue2'), )))
def test_add_agent_to_queue_two_agents(self): agent1 = self._insert_agent(42, '12') self._insert_agent_login_status(agent1.id, agent1.number) agent2 = self._insert_agent(43, '13') self._insert_agent_login_status(agent2.id, agent2.number, '1002', 'default', interface='Local/2@foo', state_interface='SIP/defabc') queues = [agent_status_dao._Queue(1, 'queue1', 0), agent_status_dao._Queue(2, 'queue2', 0), ] agent_status_dao.add_agent_to_queues(agent1.id, queues) agent_status_dao.add_agent_to_queues(agent2.id, queues) agent1_status = agent_status_dao.get_status(agent1.id) agent2_status = agent_status_dao.get_status(agent2.id) self.assertEquals(len(agent1_status.queues), 2) self.assertEquals(agent1_status.queues[0].id, 1) self.assertEquals(agent1_status.queues[0].name, 'queue1') self.assertEquals(agent1_status.queues[1].id, 2) self.assertEquals(agent1_status.queues[1].name, 'queue2') self.assertEquals(len(agent2_status.queues), 2) self.assertEquals(agent2_status.queues[0].id, 1) self.assertEquals(agent2_status.queues[0].name, 'queue1') self.assertEquals(agent2_status.queues[1].id, 2) self.assertEquals(agent2_status.queues[1].name, 'queue2')
def test_add_agent_to_queues(self): agent = self._insert_agent(42, '12') queue1 = agent_status_dao._Queue(1, 'queue1', 3) queue2 = agent_status_dao._Queue(2, 'queue2', 4) queues = [queue1, queue2] agent_status_dao.add_agent_to_queues(agent.id, queues) memberships = self.session.query(AgentMembershipStatus).all() self.assertEquals(len(memberships), 2) self.assertEquals(memberships[0].queue_id, queue1.id) self.assertEquals(memberships[0].queue_name, queue1.name) self.assertEquals(memberships[0].penalty, queue1.penalty) self.assertEquals(memberships[1].queue_id, queue2.id) self.assertEquals(memberships[1].queue_name, queue2.name) self.assertEquals(memberships[1].penalty, queue2.penalty)
def test_add_agent_to_queues(self): agent = self.add_agent() queue1 = agent_status_dao._Queue(1, 'queue1', 3) queue2 = agent_status_dao._Queue(2, 'queue2', 4) queues = [queue1, queue2] agent_status_dao.add_agent_to_queues(agent.id, queues) memberships = self.session.query(AgentMembershipStatus).all() assert_that( memberships, contains( has_properties(queue_id=queue1.id, queue_name=queue1.name, penalty=queue1.penalty), has_properties(queue_id=queue2.id, queue_name=queue2.name, penalty=queue2.penalty), ))