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 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 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_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_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)