Resolve test suite
This commit is contained in:
parent
e91b3d40a2
commit
6057da71f3
|
@ -520,6 +520,7 @@ class Sanic(BaseSanic):
|
|||
ignore_body,
|
||||
) = self.router.get(request)
|
||||
request.name = name
|
||||
request._match_info = kwargs
|
||||
|
||||
if request.stream.request_body and not ignore_body:
|
||||
if self.router.is_stream_handler(request):
|
||||
|
|
|
@ -58,6 +58,7 @@ class Request:
|
|||
"_port",
|
||||
"_remote_addr",
|
||||
"_socket",
|
||||
"_match_info",
|
||||
"app",
|
||||
"body",
|
||||
"conn_info",
|
||||
|
@ -106,6 +107,7 @@ class Request:
|
|||
self.uri_template = None
|
||||
self.request_middleware_started = False
|
||||
self._cookies = None
|
||||
self._match_info = {}
|
||||
self.stream = None
|
||||
self.endpoint = None
|
||||
|
||||
|
@ -370,7 +372,7 @@ class Request:
|
|||
@property
|
||||
def match_info(self):
|
||||
"""return matched info after resolving route"""
|
||||
return self.app.router.get(self)[2]
|
||||
return self._match_info
|
||||
|
||||
# Transport properties (obtained from local interface only)
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ def test_app_route_raise_value_error(app):
|
|||
|
||||
def test_app_handle_request_handler_is_none(app, monkeypatch):
|
||||
def mockreturn(*args, **kwargs):
|
||||
return None, [], {}, "", "", None, False
|
||||
return None, {}, "", "", False
|
||||
|
||||
# Not sure how to make app.router.get() return None, so use mock here.
|
||||
monkeypatch.setattr(app.router, "get", mockreturn)
|
||||
|
|
|
@ -126,8 +126,9 @@ def test_html_traceback_output_in_debug_mode():
|
|||
assert response.status == 500
|
||||
soup = BeautifulSoup(response.body, "html.parser")
|
||||
html = str(soup)
|
||||
print(html)
|
||||
|
||||
assert "response = handler(request, *args, **kwargs)" in html
|
||||
assert "response = handler(request, **kwargs)" in html
|
||||
assert "handler_4" in html
|
||||
assert "foo = bar" in html
|
||||
|
||||
|
@ -151,7 +152,7 @@ def test_chained_exception_handler():
|
|||
soup = BeautifulSoup(response.body, "html.parser")
|
||||
html = str(soup)
|
||||
|
||||
assert "response = handler(request, *args, **kwargs)" in html
|
||||
assert "response = handler(request, **kwargs)" in html
|
||||
assert "handler_6" in html
|
||||
assert "foo = 1 / arg" in html
|
||||
assert "ValueError" in html
|
||||
|
|
Loading…
Reference in New Issue
Block a user