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

Function test_environ_builder_basics

tests/test_test.py:140–161  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

138
139
140def test_environ_builder_basics():
141 b = EnvironBuilder()
142 assert b.content_type is None
143 b.method = "POST"
144 assert b.content_type is None
145 b.form["test"] = "normal value"
146 assert b.content_type == "application/x-www-form-urlencoded"
147 b.files.add_file("test", BytesIO(b"test contents"), "test.txt")
148 assert b.files["test"].content_type == "text/plain"
149 b.form["test_int"] = 1
150 assert b.content_type == "multipart/form-data"
151
152 req = b.get_request()
153 b.close()
154
155 assert req.url == "http://localhost/"
156 assert req.method == "POST"
157 assert req.form["test"] == "normal value"
158 assert req.files["test"].content_type == "text/plain"
159 assert req.files["test"].filename == "test.txt"
160 assert req.files["test"].read() == b"test contents"
161 req.close()
162
163
164def test_environ_builder_data():

Callers

nothing calls this directly

Calls 6

get_requestMethod · 0.95
closeMethod · 0.95
EnvironBuilderClass · 0.90
add_fileMethod · 0.80
readMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected