示例#1
0
 def parse(self, path, http_verb,
           headers=None, query_args=None, payload=None):
     context = create_context(self.tables, http_verb, headers, payload)
     urlpath.parse(path, context)
     if query_args:
         urlquery.parse(context, query_args)
     if headers:
         urlheaders.parse(context)
     context['sqlobj'] = validate_and_cleanup(context['sqlobj'], payload)
     try:
         context['payload'] = self.query(context['sqlobj'])
     except NoContent as e:
         e.code = context['response_status']
         raise e
     return self.render(context)
示例#2
0
def test(context, qargs, expected):
    try:
        ctx = urlquery.parse(context, qargs)
    except NotImplementedError:
        pytest.skip("not implemented")
    else:
        assert unicode(ctx['sqlobj']) == expected
示例#3
0
def test_req_parse_error(context, qargs):
    with pytest.raises(RequestParseError):
        urlquery.parse(context, qargs)
示例#4
0
def test_matrix_fail(context, qargs):
    with pytest.raises(RequestParseError):
        urlquery.parse(context, qargs)