Skip to content

Commit

Permalink
Fix handling of bytes / str in some places
Browse files Browse the repository at this point in the history
  • Loading branch information
fsouza committed Aug 15, 2023
1 parent 5780c6e commit 520b03a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion tests/fake_django/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def upload_file(request):
f = request.FILES["file"]
buffer = [
f"Content-type: {f.content_type}",
f"File content: {f.read()}",
f"File content: {f.read().decode('utf-8')}",
]
return HttpResponse("|".join(buffer))

Expand Down
2 changes: 1 addition & 1 deletion tests/fake_webapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def upload_file():
if request.method == "POST":
f = request.files["file"]
BUFFER.append(f"Content-type: {f.content_type}")
BUFFER.append(f"File content: {f.stream.read()}")
BUFFER.append(f"File content: {f.stream.read().decode('utf-8')}")
return redirect(url_for("upload_file"))
return "|".join(BUFFER)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_webdriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_attach_file(request, browser_name):
assert "text/plain" in html

with open(file_path) as f:
assert str(f.read().encode("utf-8")) in html
assert str(f.read()) in html


@pytest.mark.parametrize("browser_name", supported_browsers)
Expand Down

0 comments on commit 520b03a

Please sign in to comment.