Fix commented out code in test_responder.py

This commit is contained in:
2024-03-30 19:48:57 -04:00
parent a8caa3054b
commit 796fdc2ddf
+12 -11
View File
@@ -197,16 +197,16 @@ def test_query_params(api, url):
# Requires https://github.com/encode/starlette/pull/102
def test_form_data(api):
# def test_form_data(api):
@api.route("/")
async def route(req, resp):
resp.media = {"form": await req.media("form")}
# @api.route("/")
# async def route(req, resp):
# resp.media = {"form": await req.media("form")}
dump = {"q": "q"}
# dump = {"q": "q"}
r = api.requests.get(api.url_for(route), params=dump)
assert r.json()["form"] == dump
# r = api.requests.get(api.url_for(route), params=dump)
# assert r.json()["form"] == dump
def test_async_function(api):
@@ -631,10 +631,11 @@ def test_file_uploads(api):
# result["not-a-file"] = files["not-a-file"].decode("utf-8")
resp.media = {"files": result}
world = io.BytesIO(b"world")
data = {"hello": ("hello.txt", world, "text/plain"), "not-a-file": b"data only"}
r = api.requests.post(api.url_for(upload), files=data)
assert r.json() == {"files": {"hello": "world", "not-a-file": "data only"}}
# # world = io.StringIO("world")
# data = {"hello": ("hello.txt", world, "text/plain"), "not-a-file": b"data only"}
# r = api.requests.post(api.url_for(upload), files=data)
# assert r.json() == {"files": {"hello": "world", "not-a-file": "data only"}}
def test_500(api):