()
| 138 | |
| 139 | |
| 140 | def 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 | |
| 164 | def test_environ_builder_data(): |
nothing calls this directly
no test coverage detected