Exemplo n.º 1
0
def create():
    data = document.parse(request)
    line = formatter.dict_to_model(data)
    line = line_services.create(line)
    result = formatter.to_api(line)
    location = url_for('.get', lineid=line.id)
    return make_response(result, 201, {'Location': location})
Exemplo n.º 2
0
    def test_create(self, line_dao_create, line_notifier_created, make_provisioning_id):
        name = 'line'
        context = 'toto'
        secret = '1234'

        line = LineSIP(name=name,
                       context=context,
                       username=name,
                       secret=secret,
                       device_slot=1)

        line_dao_create.return_value = line

        result = line_services.create(line)

        line_dao_create.assert_called_once_with(line)
        line_notifier_created.assert_called_once_with(line)
        make_provisioning_id.assert_called_with()
        self.assertEquals(type(result), LineSIP)
Exemplo n.º 3
0
    def test_create(self, line_dao_create, line_notifier_created, make_provisioning_id):
        name = 'line'
        context = 'toto'
        secret = '1234'

        line = LineSIP(name=name,
                       context=context,
                       username=name,
                       secret=secret,
                       device_slot=1)

        line_dao_create.return_value = line

        result = line_services.create(line)

        line_dao_create.assert_called_once_with(line)
        line_notifier_created.assert_called_once_with(line)
        make_provisioning_id.assert_called_with()
        self.assertEquals(type(result), LineSIP)
Exemplo n.º 4
0
def _create_line_sip(channel, parameters):
    from xivo_dao.data_handler.line import services as line_services
    from xivo_dao.data_handler.line.model import LineSIP

    line = LineSIP(**parameters)
    line_services.create(line)
Exemplo n.º 5
0
def _create(channel, parameters):
    from xivo_dao.data_handler.line import services as line_services
    from xivo_dao.data_handler.line.model import Line

    line = Line(**parameters)
    line_services.create(line)