Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix acceptance tests with latest flask and werkzeug #391

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions atests/http_server/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,15 +179,15 @@ def redirect_to():
args_dict = request.args.items()
args = CaseInsensitiveDict(args_dict)

# We need to build the response manually and convert to UTF-8 to prevent
# werkzeug from "fixing" the URL. This endpoint should set the Location
# We need to build the response manually.
# This endpoint should set the Location
# header to the exact string supplied.
response = app.make_response("")
response.status_code = 302
if "status_code" in args:
status_code = int(args["status_code"])
if status_code >= 300 and status_code < 400:
response.status_code = status_code
response.headers["Location"] = args["url"].encode("utf-8")
response.headers["Location"] = args["url"]

return response
5 changes: 2 additions & 3 deletions atests/http_server/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
import time
import os
from hashlib import md5, sha256, sha512
from werkzeug.http import parse_authorization_header
from werkzeug.datastructures import WWWAuthenticate
from werkzeug.datastructures import WWWAuthenticate, Authorization

from flask import request, make_response
from six.moves.urllib.parse import urlparse, urlunparse
Expand Down Expand Up @@ -357,7 +356,7 @@ def check_digest_auth(user, passwd):
"""Check user authentication using HTTP Digest auth"""

if request.headers.get('Authorization'):
credentials = parse_authorization_header(request.headers.get('Authorization'))
credentials = Authorization.from_header(request.headers.get('Authorization'))
if not credentials:
return
request_uri = request.script_root + request.path
Expand Down
Loading