From 66978a8cdc04fd9705bc8a7433524260e32d971e Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Mon, 15 Oct 2018 07:14:14 -0400 Subject: [PATCH] test yaml and form too --- tests/test_responder.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/test_responder.py b/tests/test_responder.py index b9cca7b..fa816b8 100644 --- a/tests/test_responder.py +++ b/tests/test_responder.py @@ -244,3 +244,27 @@ def test_json_uploads(api, session): dump = {"complicated": "times"} r = session.post(api.url_for(route), json=dump) assert r.json() == dump + + +def test_yaml_uploads(api, session): + @api.route("/") + async def route(req, resp): + resp.media = await req.media() + + dump = {"complicated": "times"} + r = session.post( + api.url_for(route), + data=yaml.dump(dump), + headers={"Content-Type": "application/x-yaml"}, + ) + assert r.json() == dump + + +def test_form_uploads(api, session): + @api.route("/") + async def route(req, resp): + resp.media = await req.media() + + dump = {"complicated": "times"} + r = session.post(api.url_for(route), data=dump) + assert r.json() == dump