def test_delete_incall(self):
        self._add_incall(u'4000')
        common.delete_with_number('incalls', u'4000')
        common.delete_with_firstname_lastname('users',
                                              u'test_ws_user_firstname', '')

        self.assertEqual(common.nb_with_number('incalls', u'4000'), 0)
 def _add_agent(self, firstname, lastname, number):
     common.delete_with_number('agents', number)
     agent = xivo_ws.Agent()
     agent.firstname = firstname
     agent.lastname = lastname
     agent.number = number
     agent.context = u'default'
     self._xivo_ws.agents.add(agent)
 def _add_agent(self, firstname, lastname, number):
     common.delete_with_number('agents', number)
     agent = xivo_ws.Agent()
     agent.firstname = firstname
     agent.lastname = lastname
     agent.number = number
     agent.context = u'default'
     self._xivo_ws.agents.add(agent)
    def test_add_agent(self):
        agent = xivo_ws.Agent()
        agent.firstname = u'test_ws_add_agent'
        agent.number = u'5000'
        agent.context = u'default'
        common.delete_with_number('agents', agent.number)
        self._xivo_ws.agents.add(agent)

        self.assertEqual(common.nb_with_number('agents', agent.number), 1)
    def test_add_agent(self):
        agent = xivo_ws.Agent()
        agent.firstname = u'test_ws_add_agent'
        agent.number = u'5000'
        agent.context = u'default'
        common.delete_with_number('agents', agent.number)
        self._xivo_ws.agents.add(agent)

        self.assertEqual(common.nb_with_number('agents', agent.number), 1)
 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 test_add_incall(self):
        self._add_user()
        incall = xivo_ws.Incall()
        incall.number = u'4000'
        incall.context = u'from-extern'
        incall.destination = self._new_user_destination(u'test_ws_user_firstname')
        common.delete_with_number('incalls', incall.number)
        self._xivo_ws.incalls.add(incall)

        self.assertEqual(common.nb_with_number('incalls', incall.number), 1)
 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 test_add_incall(self):
        self._add_user()
        incall = xivo_ws.Incall()
        incall.number = u'4000'
        incall.context = u'from-extern'
        incall.destination = self._new_user_destination(
            u'test_ws_user_firstname')
        common.delete_with_number('incalls', incall.number)
        self._xivo_ws.incalls.add(incall)

        self.assertEqual(common.nb_with_number('incalls', incall.number), 1)
    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 test_delete_agent(self):
        self._add_agent(u'test_ws_delete_agent', '', u'5000')
        common.delete_with_number('agents', u'5000')

        self.assertEqual(common.nb_with_number('agents', u'5000'), 0)
    def test_delete_agent(self):
        self._add_agent(u'test_ws_delete_agent', '', u'5000')
        common.delete_with_number('agents', u'5000')

        self.assertEqual(common.nb_with_number('agents', u'5000'), 0)
    def test_delete_incall(self):
        self._add_incall(u'4000')
        common.delete_with_number('incalls', u'4000')
        common.delete_with_firstname_lastname('users', u'test_ws_user_firstname', '')

        self.assertEqual(common.nb_with_number('incalls', u'4000'), 0)