From: Stephon Striplin Date: Wed, 27 Jul 2011 02:39:29 +0000 (-0700) Subject: add User-Agent header tests X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=405f33e10c32bba960b25f9ac179bd32b1ba8b1d;p=s3-tests.git add User-Agent header tests --- diff --git a/s3tests/functional/test_headers.py b/s3tests/functional/test_headers.py index b8a429df..9186a046 100644 --- a/s3tests/functional/test_headers.py +++ b/s3tests/functional/test_headers.py @@ -225,3 +225,27 @@ def test_object_create_bad_contenttype_unreadable(): eq(e.status, 403) eq(e.reason, 'Forbidden') assert e.error_code in ('AccessDenied', 'SignatureDoesNotMatch') + + +@nose.with_setup(teardown=_clear_custom_headers) +def test_object_create_bad_ua_invalid(): + key = _setup_bad_object({'User-Agent': ''}) + key.set_contents_from_string('bar') + + +@nose.with_setup(teardown=_clear_custom_headers) +def test_object_create_bad_ua_empty(): + key = _setup_bad_object({'User-Agent': ''}) + key.set_contents_from_string('bar') + + +@nose.with_setup(teardown=_clear_custom_headers) +def test_object_create_bad_ua_unreadable(): + key = _setup_bad_object({'User-Agent': '\x07'}) + key.set_contents_from_string('bar') + + +@nose.with_setup(teardown=_clear_custom_headers) +def test_object_create_bad_ua_none(): + key = _setup_bad_object(remove=('User-Agent',)) + key.set_contents_from_string('bar')