()
| 162 | |
| 163 | |
| 164 | def test_environ_builder_data(): |
| 165 | b = EnvironBuilder(data="foo") |
| 166 | assert b.input_stream.getvalue() == b"foo" |
| 167 | b = EnvironBuilder(data=b"foo") |
| 168 | assert b.input_stream.getvalue() == b"foo" |
| 169 | |
| 170 | b = EnvironBuilder(data={"foo": "bar"}) |
| 171 | assert b.form["foo"] == "bar" |
| 172 | b = EnvironBuilder(data={"foo": ["bar1", "bar2"]}) |
| 173 | assert b.form.getlist("foo") == ["bar1", "bar2"] |
| 174 | |
| 175 | def check_list_content(b, length): |
| 176 | foo = b.files.getlist("foo") |
| 177 | assert len(foo) == length |
| 178 | for obj in foo: |
| 179 | assert isinstance(obj, FileStorage) |
| 180 | |
| 181 | b = EnvironBuilder(data={"foo": BytesIO()}) |
| 182 | check_list_content(b, 1) |
| 183 | b = EnvironBuilder(data={"foo": [BytesIO(), BytesIO()]}) |
| 184 | check_list_content(b, 2) |
| 185 | |
| 186 | b = EnvironBuilder(data={"foo": (BytesIO(),)}) |
| 187 | check_list_content(b, 1) |
| 188 | b = EnvironBuilder(data={"foo": [(BytesIO(),), (BytesIO(),)]}) |
| 189 | check_list_content(b, 2) |
| 190 | |
| 191 | |
| 192 | def test_environ_builder_json(): |
nothing calls this directly
no test coverage detected