async def test_from_body_form_binding_urlencoded_keys_duplicates(): request = Request("POST", b"/", []).with_content( FormContent([("a", "world"), ("b", "one"), ("b", "two"), ("b", "three")])) parameter = FormBinder(ExampleThree) value = await parameter.get_value(request) assert isinstance(value, ExampleThree) assert value.a == "world" assert value.b == ["one", "two", "three"]
async def test_from_body_form_binding_urlencoded_keys_duplicates(): request = Request('POST', b'/', []).with_content( FormContent([('a', 'world'), ('b', 'one'), ('b', 'two'), ('b', 'three')])) parameter = FromForm(ExampleThree) value = await parameter.get_value(request) assert isinstance(value, ExampleThree) assert value.a == 'world' assert value.b == ['one', 'two', 'three']
async def test_from_body_form_binding_urlencoded(): request = Request("POST", b"/", []).with_content( FormContent({"a": "world", "b": 9000}) ) parameter = FormBinder(ExampleOne) value = await parameter.get_value(request) assert isinstance(value, ExampleOne) assert value.a == "world" assert value.b == 9000
async def test_from_body_form_binding_urlencoded(): request = Request('POST', b'/', []).with_content(FormContent({ 'a': 'world', 'b': 9000 })) parameter = FromForm(ExampleOne) value = await parameter.get_value(request) assert isinstance(value, ExampleOne) assert value.a == 'world' assert value.b == 9000
async def test_post_form(session, data): response = await session.post("/echo-posted-form", FormContent(data)) ensure_success(response) assert await response.json() == data