]> git-server-git.apps.pok.os.sepia.ceph.com Git - s3-tests.git/commitdiff
add User-Agent header tests
authorStephon Striplin <stephon.striplin@dreamhost.com>
Wed, 27 Jul 2011 02:39:29 +0000 (19:39 -0700)
committerStephon Striplin <stephon.striplin@dreamhost.com>
Wed, 27 Jul 2011 17:28:03 +0000 (10:28 -0700)
s3tests/functional/test_headers.py

index b8a429dffdade82a13968ee604e9d0f25e775204..9186a046928a182f2ac400908e0b75a6024d5825 100644 (file)
@@ -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')