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)
def test(context, qargs, expected): try: ctx = urlquery.parse(context, qargs) except NotImplementedError: pytest.skip("not implemented") else: assert unicode(ctx['sqlobj']) == expected
def test_req_parse_error(context, qargs): with pytest.raises(RequestParseError): urlquery.parse(context, qargs)
def test_matrix_fail(context, qargs): with pytest.raises(RequestParseError): urlquery.parse(context, qargs)