diff options
author | Peter Portante <peter.portante@redhat.com> | 2013-10-24 22:04:40 -0400 |
---|---|---|
committer | Luis Pabon <lpabon@redhat.com> | 2013-10-25 10:57:40 -0700 |
commit | 04e402599b7b01c0a98df4724618555ab53cb775 (patch) | |
tree | 591827e1d367202105be2463c5858666ad6827a0 /test/functionalnosetests | |
parent | b48149a4af9bc2c5de14a4f479bc7b11938bcf94 (diff) |
Sync functional tests with Swift v1.9.1
Change-Id: Id478f651fe937883837291059da9da853fcd2de2
Signed-off-by: Peter Portante <peter.portante@redhat.com>
Reviewed-on: http://review.gluster.org/6141
Reviewed-by: Luis Pabon <lpabon@redhat.com>
Tested-by: Luis Pabon <lpabon@redhat.com>
Diffstat (limited to 'test/functionalnosetests')
-rw-r--r-- | test/functionalnosetests/swift_testing.py | 7 | ||||
-rwxr-xr-x | test/functionalnosetests/test_account.py | 42 | ||||
-rwxr-xr-x | test/functionalnosetests/test_container.py | 42 | ||||
-rwxr-xr-x | test/functionalnosetests/test_object.py | 8 |
4 files changed, 87 insertions, 12 deletions
diff --git a/test/functionalnosetests/swift_testing.py b/test/functionalnosetests/swift_testing.py index ef4005e..c49d9cd 100644 --- a/test/functionalnosetests/swift_testing.py +++ b/test/functionalnosetests/swift_testing.py @@ -28,13 +28,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import errno import os import socket import sys from time import sleep -from nose import SkipTest -from ConfigParser import MissingSectionHeaderError from test import get_config @@ -168,10 +165,10 @@ def retry(func, *args, **kwargs): if attempts > retries: raise parsed[use_account] = conn[use_account] = None - except AuthError, err: + except AuthError: url[use_account] = token[use_account] = None continue - except InternalServerError, err: + except InternalServerError: pass if attempts <= retries: sleep(backoff) diff --git a/test/functionalnosetests/test_account.py b/test/functionalnosetests/test_account.py index 16e3dea..d28ff2f 100755 --- a/test/functionalnosetests/test_account.py +++ b/test/functionalnosetests/test_account.py @@ -37,7 +37,7 @@ from nose import SkipTest from swift.common.constraints import MAX_META_COUNT, MAX_META_NAME_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): @@ -78,6 +78,46 @@ class TestAccount(unittest.TestCase): self.assert_(resp.status in (200, 204), resp.status) self.assertEquals(resp.getheader('x-account-meta-test'), 'Value') + def test_unicode_metadata(self): + if skip: + raise SkipTest + + def post(url, token, parsed, conn, name, value): + conn.request('POST', parsed.path, '', + {'X-Auth-Token': token, name: value}) + return check_response(conn) + + def head(url, token, parsed, conn): + conn.request('HEAD', parsed.path, '', {'X-Auth-Token': token}) + return check_response(conn) + uni_key = u'X-Account-Meta-uni\u0E12' + uni_value = u'uni\u0E12' + if (web_front_end == 'integral'): + resp = retry(post, uni_key, '1') + resp.read() + self.assertTrue(resp.status in (201, 204)) + resp = retry(head) + resp.read() + self.assert_(resp.status in (200, 204), resp.status) + self.assertEquals(resp.getheader(uni_key.encode('utf-8')), '1') + resp = retry(post, 'X-Account-Meta-uni', uni_value) + resp.read() + self.assertEquals(resp.status, 204) + resp = retry(head) + resp.read() + self.assert_(resp.status in (200, 204), resp.status) + self.assertEquals(resp.getheader('X-Account-Meta-uni'), + uni_value.encode('utf-8')) + if (web_front_end == 'integral'): + resp = retry(post, uni_key, uni_value) + resp.read() + self.assertEquals(resp.status, 204) + resp = retry(head) + resp.read() + self.assert_(resp.status in (200, 204), resp.status) + self.assertEquals(resp.getheader(uni_key.encode('utf-8')), + uni_value.encode('utf-8')) + def test_multi_metadata(self): if skip: raise SkipTest diff --git a/test/functionalnosetests/test_container.py b/test/functionalnosetests/test_container.py index 75269c3..af78a7a 100755 --- a/test/functionalnosetests/test_container.py +++ b/test/functionalnosetests/test_container.py @@ -114,6 +114,48 @@ class TestContainer(unittest.TestCase): self.assertEquals(resp.getheader('x-container-meta-one'), '1') self.assertEquals(resp.getheader('x-container-meta-two'), '2') + def test_unicode_metadata(self): + if skip: + raise SkipTest + + def post(url, token, parsed, conn, name, value): + conn.request('POST', parsed.path + '/' + self.name, '', + {'X-Auth-Token': token, name: value}) + return check_response(conn) + + def head(url, token, parsed, conn): + conn.request('HEAD', parsed.path + '/' + self.name, '', + {'X-Auth-Token': token}) + return check_response(conn) + + uni_key = u'X-Container-Meta-uni\u0E12' + uni_value = u'uni\u0E12' + if (web_front_end == 'integral'): + resp = retry(post, uni_key, '1') + resp.read() + self.assertEquals(resp.status, 204) + resp = retry(head) + resp.read() + self.assert_(resp.status in (200, 204), resp.status) + self.assertEquals(resp.getheader(uni_key.encode('utf-8')), '1') + resp = retry(post, 'X-Container-Meta-uni', uni_value) + resp.read() + self.assertEquals(resp.status, 204) + resp = retry(head) + resp.read() + self.assert_(resp.status in (200, 204), resp.status) + self.assertEquals(resp.getheader('X-Container-Meta-uni'), + uni_value.encode('utf-8')) + if (web_front_end == 'integral'): + resp = retry(post, uni_key, uni_value) + resp.read() + self.assertEquals(resp.status, 204) + resp = retry(head) + resp.read() + self.assert_(resp.status in (200, 204), resp.status) + self.assertEquals(resp.getheader(uni_key.encode('utf-8')), + uni_value.encode('utf-8')) + def test_PUT_metadata(self): if skip: raise SkipTest diff --git a/test/functionalnosetests/test_object.py b/test/functionalnosetests/test_object.py index 9c7f9c5..3972aaf 100755 --- a/test/functionalnosetests/test_object.py +++ b/test/functionalnosetests/test_object.py @@ -34,12 +34,8 @@ import unittest from nose import SkipTest from uuid import uuid4 -from swift.common.constraints import MAX_META_COUNT, MAX_META_NAME_LENGTH, \ - MAX_META_OVERALL_SIZE, MAX_META_VALUE_LENGTH - from swift_testing import check_response, retry, skip, skip3, \ swift_test_perm, web_front_end -from test import get_config class TestObject(unittest.TestCase): @@ -127,7 +123,7 @@ class TestObject(unittest.TestCase): 'X-Copy-From': source}) return check_response(conn) resp = retry(put) - contents = resp.read() + resp.read() self.assertEquals(resp.status, 201) # contents of dest should be the same as source @@ -161,7 +157,7 @@ class TestObject(unittest.TestCase): 'Destination': dest}) return check_response(conn) resp = retry(copy) - contents = resp.read() + resp.read() self.assertEquals(resp.status, 201) # contents of dest should be the same as source |