Revert "Remove tests incompatible with werkzeug 2.3.0 (#6257)" (#6266)

This reverts commit da39d2103c.
This commit is contained in:
Bert Blommers 2023-04-28 14:38:04 +00:00 committed by GitHub
parent f38babb026
commit 2cd773fe95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 11 additions and 8 deletions

View File

@ -201,7 +201,7 @@ class DomainDispatcherApplication:
finally:
if body:
# We've consumed the body = need to reset it
environ["wsgi.input"] = io.StringIO(body)
environ["wsgi.input"] = io.BytesIO(body.encode("utf-8"))
return body
def get_service_from_body(

View File

@ -57,6 +57,7 @@ class TestAccountIdResolution:
headers = {
"Authorization": "AWS4-HMAC-SHA256 Credential=abcd/20010101/us-east-2/sts/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=...",
"Content-Length": f"{len(data)}",
"Content-Type": "application/x-www-form-urlencoded",
}
headers.update(extra_headers or {})
return requests.post(f"{BASE_URL}", headers=headers, data=data)

View File

View File

@ -1,3 +1,4 @@
import base64
import boto3
import json
import requests
@ -81,8 +82,13 @@ class TestRecorder(TestCase):
content = json.loads(self._download_recording())
content.should.have.key("body").should.contain("Action=RunInstances")
content.should.have.key("body").should.contain(f"ImageId={EXAMPLE_AMI_ID}")
if content.get("body_encoded"):
body = base64.b64decode(content.get("body")).decode("ascii")
else:
body = content["body"]
body.should.contain("Action=RunInstances")
body.should.contain(f"ImageId={EXAMPLE_AMI_ID}")
def test_multiple_services(self):
self._start_recording()

View File

@ -36,12 +36,8 @@ def test_s3_server_get():
res.data.should.contain(b"ListAllMyBucketsResult")
@pytest.mark.parametrize("key_name", ["bar_baz", "baz bar"])
@pytest.mark.parametrize("key_name", ["bar_baz", "bar+baz", "baz bar"])
def test_s3_server_bucket_create(key_name):
# Very similar test in test_s3.py::test_get_object_versions_with_prefix
# That test also includes a key containing a +, such as 'baz+bar'
# We cannot test that example here, because Werkzeug (as of 2.3.0) will helpfully normalize that to `baz bar`
# TODO: re-enable this key-name if/when we ever replace Werkzeug
test_client = authenticated_client()
res = test_client.put("/", "http://foobaz.localhost:5000/")