Skip to content

Commit

Permalink
Starlette binary request test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
p1c2u committed Sep 26, 2023
1 parent 1eff5a2 commit 1384e55
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,8 @@ def pet_photo_endpoint(request):
if request.method == "GET":
response = StreamingResponse([OPENID_LOGO], media_type="image/gif")
elif request.method == "POST":
with request.form() as form:
filename = form["file"].filename
contents = form["file"].read()
response = Response(status_code=201)
contents = request.body()
response = Response(status_code=201)
openapi_response = StarletteOpenAPIResponse(response)
response_unmarshalled = unmarshal_response(
openapi_request, openapi_response, spec=spec
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,12 @@ def test_post_valid(self, client, data_gif):
"Api-Key": self.api_key_encoded,
"Content-Type": content_type,
}
data = {
"file": data_gif,
}

cookies = {"user": "1"}
response = client.post(
"/v1/pets/1/photo",
headers=headers,
data=data,
data=data_gif,
cookies=cookies,
)

Expand Down

0 comments on commit 1384e55

Please sign in to comment.