Swift tests for unicode headers
Swift functional tests sends ilegal headers (unicode) and expects these headers to be processed by Swift. Apache2 seem to remove such headers which is a sound behavior for illegal headers. This change restrict the test tpo exist only for swift integral web front end. For future it is advised to disallow such behaviour. For example it is suggested to make the decission that in future APIs illegal headers are removed rather than processed. Change-Id: Ibf548f474de3f06a2687f8f4812beaeaf81ab216 Fixes: Bug #1189123
This commit is contained in:
parent
03c0c5d658
commit
6d59cbf596
@ -21,7 +21,7 @@ from nose import SkipTest
|
|||||||
from swift.common.constraints import MAX_META_COUNT, MAX_META_NAME_LENGTH, \
|
from swift.common.constraints import MAX_META_COUNT, MAX_META_NAME_LENGTH, \
|
||||||
MAX_META_OVERALL_SIZE, MAX_META_VALUE_LENGTH
|
MAX_META_OVERALL_SIZE, MAX_META_VALUE_LENGTH
|
||||||
|
|
||||||
from swift_testing import check_response, retry, skip
|
from swift_testing import check_response, retry, skip, web_front_end
|
||||||
|
|
||||||
|
|
||||||
class TestAccount(unittest.TestCase):
|
class TestAccount(unittest.TestCase):
|
||||||
@ -74,9 +74,9 @@ class TestAccount(unittest.TestCase):
|
|||||||
def head(url, token, parsed, conn):
|
def head(url, token, parsed, conn):
|
||||||
conn.request('HEAD', parsed.path, '', {'X-Auth-Token': token})
|
conn.request('HEAD', parsed.path, '', {'X-Auth-Token': token})
|
||||||
return check_response(conn)
|
return check_response(conn)
|
||||||
|
|
||||||
uni_key = u'X-Account-Meta-uni\u0E12'
|
uni_key = u'X-Account-Meta-uni\u0E12'
|
||||||
uni_value = u'uni\u0E12'
|
uni_value = u'uni\u0E12'
|
||||||
|
if (web_front_end == 'integral'):
|
||||||
resp = retry(post, uni_key, '1')
|
resp = retry(post, uni_key, '1')
|
||||||
resp.read()
|
resp.read()
|
||||||
self.assertTrue(resp.status in (201, 204))
|
self.assertTrue(resp.status in (201, 204))
|
||||||
@ -92,6 +92,7 @@ class TestAccount(unittest.TestCase):
|
|||||||
self.assert_(resp.status in (200, 204), resp.status)
|
self.assert_(resp.status in (200, 204), resp.status)
|
||||||
self.assertEquals(resp.getheader('X-Account-Meta-uni'),
|
self.assertEquals(resp.getheader('X-Account-Meta-uni'),
|
||||||
uni_value.encode('utf-8'))
|
uni_value.encode('utf-8'))
|
||||||
|
if (web_front_end == 'integral'):
|
||||||
resp = retry(post, uni_key, uni_value)
|
resp = retry(post, uni_key, uni_value)
|
||||||
resp.read()
|
resp.read()
|
||||||
self.assertEquals(resp.status, 204)
|
self.assertEquals(resp.status, 204)
|
||||||
|
@ -115,6 +115,7 @@ class TestContainer(unittest.TestCase):
|
|||||||
|
|
||||||
uni_key = u'X-Container-Meta-uni\u0E12'
|
uni_key = u'X-Container-Meta-uni\u0E12'
|
||||||
uni_value = u'uni\u0E12'
|
uni_value = u'uni\u0E12'
|
||||||
|
if (web_front_end == 'integral'):
|
||||||
resp = retry(post, uni_key, '1')
|
resp = retry(post, uni_key, '1')
|
||||||
resp.read()
|
resp.read()
|
||||||
self.assertEquals(resp.status, 204)
|
self.assertEquals(resp.status, 204)
|
||||||
@ -130,6 +131,7 @@ class TestContainer(unittest.TestCase):
|
|||||||
self.assert_(resp.status in (200, 204), resp.status)
|
self.assert_(resp.status in (200, 204), resp.status)
|
||||||
self.assertEquals(resp.getheader('X-Container-Meta-uni'),
|
self.assertEquals(resp.getheader('X-Container-Meta-uni'),
|
||||||
uni_value.encode('utf-8'))
|
uni_value.encode('utf-8'))
|
||||||
|
if (web_front_end == 'integral'):
|
||||||
resp = retry(post, uni_key, uni_value)
|
resp = retry(post, uni_key, uni_value)
|
||||||
resp.read()
|
resp.read()
|
||||||
self.assertEquals(resp.status, 204)
|
self.assertEquals(resp.status, 204)
|
||||||
|
Loading…
Reference in New Issue
Block a user