if tls is enabled, boto will switch to STREAMING-UNSIGNED-PAYLOAD-TRAILER
and omit the provided content-length header. this leads to test failure:
> ________________ test_object_create_bad_contentlength_negative _________________
> e = assert_raises(ClientError, client.put_object, Bucket=bucket_name, Key=key_name, ContentLength=-1)
> AssertionError: ClientError not raised
Signed-off-by: Casey Bodley <cbodley@redhat.com>
import boto3
import pytest
+import botocore.config
from botocore.exceptions import ClientError
from email.utils import formatdate
@pytest.mark.auth_common
@pytest.mark.fails_on_mod_proxy_fcgi
def test_object_create_bad_contentlength_negative():
- client = get_client()
+ # to test Content-Length=-1, we have to prevent the checksum calculation
+ # from switching to STREAMING-UNSIGNED-PAYLOAD-TRAILER
+ config = botocore.config.Config(request_checksum_calculation = 'when_required')
+ client = get_client(config)
bucket_name = get_new_bucket()
key_name = 'foo'
e = assert_raises(ClientError, client.put_object, Bucket=bucket_name, Key=key_name, ContentLength=-1)