diff options
author | Mitch Garnaat <mitch@garnaat.com> | 2012-05-15 18:59:46 -0700 |
---|---|---|
committer | Mitch Garnaat <mitch@garnaat.com> | 2012-05-15 18:59:46 -0700 |
commit | 1aa1133e8502ea6c95e49ac34681569df5ace46b (patch) | |
tree | a25397b20d7d409131ccfbfce5d4dca23d7e52a4 /tests/s3/test_connection.py | |
parent | 911f42b97fdccbc55e160ec323df0cad6fe64c6b (diff) | |
parent | 6588ea270bfc9e0bb4d17263b72ee8b5255545c5 (diff) | |
download | boto-2.4.0.tar.gz |
Merge branch 'release-2.4.0'2.4.0
Diffstat (limited to 'tests/s3/test_connection.py')
-rw-r--r-- | tests/s3/test_connection.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/s3/test_connection.py b/tests/s3/test_connection.py index e9d372e5..ce1884b0 100644 --- a/tests/s3/test_connection.py +++ b/tests/s3/test_connection.py @@ -28,6 +28,8 @@ import unittest import time import os import urllib +import urlparse +import httplib from boto.s3.connection import S3Connection from boto.s3.bucket import Bucket from boto.exception import S3PermissionsError, S3ResponseError @@ -70,9 +72,24 @@ class S3ConnectionTest (unittest.TestCase): assert s1 == file.read(), 'invalid URL %s' % url url = k.generate_url(3600, force_http=True, headers={'x-amz-x-token' : 'XYZ'}) file = urllib.urlopen(url) + assert s1 == file.read(), 'invalid URL %s' % url rh = {'response-content-disposition': 'attachment; filename="foo.txt"'} url = k.generate_url(60, response_headers=rh) + file = urllib.urlopen(url) + assert s1 == file.read(), 'invalid URL %s' % url + #test whether amperands and to-be-escaped characters work in header filename + rh = {'response-content-disposition': 'attachment; filename="foo&z%20ar&ar&zar&bar.txt"'} + url = k.generate_url(60, response_headers=rh, force_http=True) + file = urllib.urlopen(url) assert s1 == file.read(), 'invalid URL %s' % url + # overwrite foobar contents with a PUT + url = k.generate_url(3600, 'PUT', force_http=True, policy='private', reduced_redundancy=True) + up = urlparse.urlsplit(url) + con = httplib.HTTPConnection(up.hostname, up.port) + con.request("PUT", up.path + '?' + up.query, body="hello there") + resp = con.getresponse() + assert 200 == resp.status + assert "hello there" == k.get_contents_as_string() bucket.delete_key(k) # test a few variations on get_all_keys - first load some data # for the first one, let's override the content type |