def test_edit_agent(self):
        self._add_agent(u'test_ws_add_agent', '', u'5000')
        agent = common.find_with_number('agents', u'5000')[0]
        agent.firstname = u'test_ws_edit_agent'
        self._xivo_ws.agents.edit(agent)
        agent = common.find_with_number('agents', u'5000')[0]

        self.assertEqual(agent.firstname, u'test_ws_edit_agent')
    def test_edit_agent(self):
        self._add_agent(u'test_ws_add_agent', '', u'5000')
        agent = common.find_with_number('agents', u'5000')[0]
        agent.firstname = u'test_ws_edit_agent'
        self._xivo_ws.agents.edit(agent)
        agent = common.find_with_number('agents', u'5000')[0]

        self.assertEqual(agent.firstname, u'test_ws_edit_agent')
    def test_edit_incall(self):
        common.delete_with_number('incalls', u'4001')
        self._add_incall(u'4000')
        incall = common.find_with_number('incalls', u'4000')[0]
        incall.number = u'4001'
        incall.context = u'from-extern'
        incall.destination = self._new_user_destination(u'test_ws_user_firstname')
        self._xivo_ws.incalls.edit(incall)
        incall = common.find_with_number('incalls', u'4001')[0]

        self.assertEqual(incall.number, u'4001')
    def test_edit_incall(self):
        common.delete_with_number('incalls', u'4001')
        self._add_incall(u'4000')
        incall = common.find_with_number('incalls', u'4000')[0]
        incall.number = u'4001'
        incall.context = u'from-extern'
        incall.destination = self._new_user_destination(
            u'test_ws_user_firstname')
        self._xivo_ws.incalls.edit(incall)
        incall = common.find_with_number('incalls', u'4001')[0]

        self.assertEqual(incall.number, u'4001')
 def _add_incall(self, number):
     self._add_user()
     common.delete_with_number('incalls', number)
     incall = xivo_ws.Incall()
     incall.number = number
     incall.context = u'from-extern'
     incall.destination = self._new_user_destination(u'test_ws_user_firstname')
     self._xivo_ws.incalls.add(incall)
     incall = common.find_with_number('incalls', number)[0]
     return incall.id
 def _add_incall(self, number):
     self._add_user()
     common.delete_with_number('incalls', number)
     incall = xivo_ws.Incall()
     incall.number = number
     incall.context = u'from-extern'
     incall.destination = self._new_user_destination(
         u'test_ws_user_firstname')
     self._xivo_ws.incalls.add(incall)
     incall = common.find_with_number('incalls', number)[0]
     return incall.id