def test_edit_context(self):
        common.delete_with_name('contexts', u'test_ws_edit_context')
        self._add_context(u'test_ws_add_context')
        context = common.find_with_name('contexts', u'test_ws_add_context')[0]
        context.name = u'test_ws_edit_context'
        context.display_name = u'test_ws_edit_context'
        self._xivo_ws.contexts.edit(context)
        context = common.find_with_name('contexts', u'test_ws_edit_context')[0]

        self.assertEqual(context.name, u'test_ws_edit_context')
    def test_edit_group(self):
        common.delete_with_name('groups', u'test_ws_edit_group')
        self._add_group(u'test_ws_add_group')
        group = common.find_with_name('groups', u'test_ws_add_group')[0]
        group.name = u'test_ws_edit_group'
        group.context = u'default'
        self._xivo_ws.groups.edit(group)
        group = common.find_with_name('groups', u'test_ws_edit_group')[0]

        self.assertEqual(group.name, u'test_ws_edit_group')
    def test_edit_trunksip(self):
        common.delete_with_name('sip_trunks', u'test_ws_edit_trunksip')
        self._add_trunksip(u'test_ws_add_trunksip')
        trunksip = common.find_with_name('sip_trunks', u'test_ws_add_trunksip')[0]
        trunksip.name = u'test_ws_edit_trunksip'
        trunksip.context = u'default'
        self._xivo_ws.sip_trunks.edit(trunksip)
        trunksip = common.find_with_name('sip_trunks', u'test_ws_edit_trunksip')[0]

        self.assertEqual(trunksip.name, u'test_ws_edit_trunksip')
    def test_edit_entity(self):
        common.delete_with_name('entities', u'test_ws_edit_entity')
        self._add_entity(u'test_ws_add_entity')
        entity = common.find_with_name('entities', u'test_ws_add_entity')[0]
        entity.name = u'test_ws_edit_entity'
        entity.display_name = u'test_ws_edit_entity'
        self._xivo_ws.entities.edit(entity)
        entity = common.find_with_name('entities', u'test_ws_edit_entity')[0]

        self.assertEqual(entity.name, u'test_ws_edit_entity')
    def test_edit_trunksip(self):
        common.delete_with_name('sip_trunks', u'test_ws_edit_trunksip')
        self._add_trunksip(u'test_ws_add_trunksip')
        trunksip = common.find_with_name('sip_trunks',
                                         u'test_ws_add_trunksip')[0]
        trunksip.name = u'test_ws_edit_trunksip'
        trunksip.context = u'default'
        self._xivo_ws.sip_trunks.edit(trunksip)
        trunksip = common.find_with_name('sip_trunks',
                                         u'test_ws_edit_trunksip')[0]

        self.assertEqual(trunksip.name, u'test_ws_edit_trunksip')
Example #6
0
 def _add_group(self, name, context='default'):
     common.delete_with_name('groups', name)
     group = xivo_ws.Group()
     group.name = name
     group.context = context
     self._xivo_ws.groups.add(group)
     group = common.find_with_name('groups', name)[0]
     return group.id
 def _add_group(self, name, context='default'):
     common.delete_with_name('groups', name)
     group = xivo_ws.Group()
     group.name = name
     group.context = context
     self._xivo_ws.groups.add(group)
     group = common.find_with_name('groups', name)[0]
     return group.id
 def _add_entity(self, name):
     common.delete_with_name('entities', name)
     entity = xivo_ws.Entity()
     entity.name = name
     entity.display_name = name
     self._xivo_ws.entities.add(entity)
     entity = common.find_with_name('entities', name)[0]
     return entity.id
 def _add_sip_line(self, name, secret, context='default'):
     common.delete_with_name('lines', name)
     line = xivo_ws.Line()
     line.protocol = line.PROTOCOL_SIP
     line.name = name
     line.secret = secret
     line.context = context
     common.delete_with_name('lines', name)
     self._xivo_ws.lines.add(line)
     line = common.find_with_name('lines', name)[0]
     return line.id
 def _add_sip_line(self, name, secret, context='default'):
     common.delete_with_name('lines', name)
     line = xivo_ws.Line()
     line.protocol = line.PROTOCOL_SIP
     line.name = name
     line.secret = secret
     line.context = context
     common.delete_with_name('lines', name)
     self._xivo_ws.lines.add(line)
     line = common.find_with_name('lines', name)[0]
     return line.id