Python3: fix glance.tests.functional.v2.test_images

Change-Id: Ib72948e5155bec3530cf430e70a3d77e613cbdcd
This commit is contained in:
Cyril Roelandt 2016-11-25 18:30:20 +01:00
parent 37a6f30aa0
commit ddb2b87a20
2 changed files with 6 additions and 5 deletions

View File

@ -1400,7 +1400,7 @@ class TestImages(functional.FunctionalTest):
self.size = size
def __iter__(self):
yield 'Z' * self.size
yield b'Z' * self.size
response = requests.put(path, headers=headers, data=StreamSim(
self.api_server.image_size_cap + 1))
@ -3665,22 +3665,22 @@ class TestQuotas(functional.FunctionalTest):
self.assertEqual(http.NO_CONTENT, response.status_code)
def test_image_upload_under_quota(self):
data = 'x' * (self.user_storage_quota - 1)
data = b'x' * (self.user_storage_quota - 1)
self._upload_image_test(data, http.NO_CONTENT)
def test_image_upload_exceed_quota(self):
data = 'x' * (self.user_storage_quota + 1)
data = b'x' * (self.user_storage_quota + 1)
self._upload_image_test(data, http.REQUEST_ENTITY_TOO_LARGE)
def test_chunked_image_upload_under_quota(self):
def data_gen():
yield 'x' * (self.user_storage_quota - 1)
yield b'x' * (self.user_storage_quota - 1)
self._upload_image_test(data_gen(), http.NO_CONTENT)
def test_chunked_image_upload_exceed_quota(self):
def data_gen():
yield 'x' * (self.user_storage_quota + 1)
yield b'x' * (self.user_storage_quota + 1)
self._upload_image_test(data_gen(), http.REQUEST_ENTITY_TOO_LARGE)

View File

@ -56,6 +56,7 @@ commands =
glance.tests.functional.v2.test_metadef_properties \
glance.tests.functional.v2.test_metadef_resourcetypes \
glance.tests.functional.v2.test_metadef_tags \
glance.tests.functional.v2.test_images \
glance.tests.functional.v2.test_metadef_namespaces
[testenv:pep8]