MCPcopy
hub / github.com/pallets/werkzeug / test_wrapper_internals

Function test_wrapper_internals

tests/test_internal.py:6–30  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4
5
6def test_wrapper_internals():
7 req = Request.from_values(data={"foo": "bar"}, method="POST")
8 req._load_form_data()
9 assert req.form.to_dict() == {"foo": "bar"}
10
11 # second call does not break
12 req._load_form_data()
13 assert req.form.to_dict() == {"foo": "bar"}
14
15 # check reprs
16 assert repr(req) == "<Request 'http://localhost/' [POST]>"
17 resp = Response()
18 assert repr(resp) == "<Response 0 bytes [200 OK]>"
19 resp.set_data("Hello World!")
20 assert repr(resp) == "<Response 12 bytes [200 OK]>"
21 resp.response = iter(["Test"])
22 assert repr(resp) == "<Response streamed [200 OK]>"
23
24 response = Response(["Hällo Wörld"])
25 headers = response.get_wsgi_headers(create_environ())
26 assert "Content-Length" in headers
27
28 response = Response(["Hällo Wörld".encode()])
29 headers = response.get_wsgi_headers(create_environ())
30 assert "Content-Length" in headers

Callers

nothing calls this directly

Calls 7

set_dataMethod · 0.95
get_wsgi_headersMethod · 0.95
ResponseClass · 0.90
create_environFunction · 0.90
from_valuesMethod · 0.80
_load_form_dataMethod · 0.80
to_dictMethod · 0.80

Tested by

no test coverage detected