From be997b53ab23c68a34c40721b1d74fb29096852f Mon Sep 17 00:00:00 2001 From: xuanyandong Date: Sun, 3 Jan 2021 15:49:32 +0800 Subject: [PATCH] Remove unicode literal strings Co-Authored-By: Cyril Roelandt Change-Id: Id9e1a5fb9c732c207ee08f0dbf387436a1783174 --- api-ref/source/conf.py | 8 +- doc/source/conf.py | 42 +- glance/common/utils.py | 4 +- glance/tests/functional/db/base.py | 22 +- glance/tests/functional/db/base_metadef.py | 38 +- glance/tests/functional/v2/test_images.py | 760 +++++++++--------- .../functional/v2/test_metadef_namespaces.py | 20 +- .../functional/v2/test_metadef_objects.py | 20 +- .../functional/v2/test_metadef_properties.py | 16 +- .../tests/functional/v2/test_metadef_tags.py | 8 +- glance/tests/functional/v2/test_tasks.py | 26 +- glance/tests/unit/common/test_client.py | 6 +- glance/tests/unit/common/test_utils.py | 12 +- glance/tests/unit/common/test_wsgi.py | 4 +- glance/tests/unit/test_store_image.py | 20 +- .../unit/v2/test_image_members_resource.py | 2 +- glance/tests/unit/v2/test_images_resource.py | 216 ++--- .../tests/unit/v2/test_metadef_resources.py | 26 +- releasenotes/source/conf.py | 16 +- 19 files changed, 633 insertions(+), 633 deletions(-) diff --git a/api-ref/source/conf.py b/api-ref/source/conf.py index 32a69d78e3..fe113db312 100644 --- a/api-ref/source/conf.py +++ b/api-ref/source/conf.py @@ -63,7 +63,7 @@ source_suffix = '.rst' # The master toctree document. master_doc = 'index' -copyright = u'2010-present, OpenStack Foundation' +copyright = '2010-present, OpenStack Foundation' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -102,7 +102,7 @@ openstackdocs_bug_tag = 'api-ref' # -- Options for man page output ---------------------------------------------- # Grouping the document tree for man pages. -# List of tuples 'sourcefile', 'target', u'title', u'Authors name', 'manual' +# List of tuples 'sourcefile', 'target', 'title', 'Authors name', 'manual' # -- Options for HTML output -------------------------------------------------- @@ -188,8 +188,8 @@ htmlhelp_basename = 'glancedoc' # (source start file, target name, title, author, documentclass # [howto/manual]). latex_documents = [ - ('index', 'Glance.tex', u'OpenStack Image Service API Documentation', - u'OpenStack Foundation', 'manual'), + ('index', 'Glance.tex', 'OpenStack Image Service API Documentation', + 'OpenStack Foundation', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of diff --git a/doc/source/conf.py b/doc/source/conf.py index f586625d7a..58b4b813de 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -75,7 +75,7 @@ policy_generator_config_file = [ master_doc = 'index' # General information about the project. -copyright = u'2010-present, OpenStack Foundation.' +copyright = '2010-present, OpenStack Foundation.' exclude_patterns = [ # The man directory includes some snippet files that are included @@ -104,27 +104,27 @@ modindex_common_prefix = ['glance.'] # -- Options for man page output -------------------------------------------- # Grouping the document tree for man pages. -# List of tuples 'sourcefile', 'target', u'title', u'Authors name', 'manual' +# List of tuples 'sourcefile', 'target', 'title', 'Authors name', 'manual' man_pages = [ - ('cli/glanceapi', 'glance-api', u'Glance API Server', - [u'OpenStack'], 1), - ('cli/glancecachecleaner', 'glance-cache-cleaner', u'Glance Cache Cleaner', - [u'OpenStack'], 1), - ('cli/glancecachemanage', 'glance-cache-manage', u'Glance Cache Manager', - [u'OpenStack'], 1), + ('cli/glanceapi', 'glance-api', 'Glance API Server', + ['OpenStack'], 1), + ('cli/glancecachecleaner', 'glance-cache-cleaner', 'Glance Cache Cleaner', + ['OpenStack'], 1), + ('cli/glancecachemanage', 'glance-cache-manage', 'Glance Cache Manager', + ['OpenStack'], 1), ('cli/glancecacheprefetcher', 'glance-cache-prefetcher', - u'Glance Cache Pre-fetcher', [u'OpenStack'], 1), - ('cli/glancecachepruner', 'glance-cache-pruner', u'Glance Cache Pruner', - [u'OpenStack'], 1), - ('cli/glancecontrol', 'glance-control', u'Glance Daemon Control Helper ', - [u'OpenStack'], 1), - ('cli/glancemanage', 'glance-manage', u'Glance Management Utility', - [u'OpenStack'], 1), - ('cli/glancereplicator', 'glance-replicator', u'Glance Replicator', - [u'OpenStack'], 1), - ('cli/glancescrubber', 'glance-scrubber', u'Glance Scrubber Service', - [u'OpenStack'], 1) + 'Glance Cache Pre-fetcher', ['OpenStack'], 1), + ('cli/glancecachepruner', 'glance-cache-pruner', 'Glance Cache Pruner', + ['OpenStack'], 1), + ('cli/glancecontrol', 'glance-control', 'Glance Daemon Control Helper ', + ['OpenStack'], 1), + ('cli/glancemanage', 'glance-manage', 'Glance Management Utility', + ['OpenStack'], 1), + ('cli/glancereplicator', 'glance-replicator', 'Glance Replicator', + ['OpenStack'], 1), + ('cli/glancescrubber', 'glance-scrubber', 'Glance Scrubber Service', + ['OpenStack'], 1) ] @@ -158,6 +158,6 @@ html_use_index = True # (source start file, target name, title, author, # documentclass [howto/manual]). latex_documents = [ - ('index', 'Glance.tex', u'Glance Documentation', - u'Glance Team', 'manual'), + ('index', 'Glance.tex', 'Glance Documentation', + 'Glance Team', 'manual'), ] diff --git a/glance/common/utils.py b/glance/common/utils.py index 6eabe21aee..ec10dc59a1 100644 --- a/glance/common/utils.py +++ b/glance/common/utils.py @@ -499,10 +499,10 @@ def parse_valid_host_port(host_port): try: - REGEX_4BYTE_UNICODE = re.compile(u'[\U00010000-\U0010ffff]') + REGEX_4BYTE_UNICODE = re.compile('[\U00010000-\U0010ffff]') except re.error: # UCS-2 build case - REGEX_4BYTE_UNICODE = re.compile(u'[\uD800-\uDBFF][\uDC00-\uDFFF]') + REGEX_4BYTE_UNICODE = re.compile('[\uD800-\uDBFF][\uDC00-\uDFFF]') def no_4byte_params(f): diff --git a/glance/tests/functional/db/base.py b/glance/tests/functional/db/base.py index 94f0a17304..637791542f 100644 --- a/glance/tests/functional/db/base.py +++ b/glance/tests/functional/db/base.py @@ -230,7 +230,7 @@ class DriverTests(object): self.db_api.image_create, self.context, fixture) def test_image_create_bad_name(self): - bad_name = u'A name with forbidden symbol \U0001f62a' + bad_name = 'A name with forbidden symbol \U0001f62a' fixture = {'name': bad_name, 'size': 12, 'status': 'queued'} self.assertRaises(exception.Invalid, self.db_api.image_create, self.context, fixture) @@ -243,7 +243,7 @@ class DriverTests(object): self.context, fixture) # if checksum is not longer than 32 characters but non-ascii -> # still raise 400 - fixture = {'checksum': u'\u042f' * 32} + fixture = {'checksum': '\u042f' * 32} self.assertRaises(exception.Invalid, self.db_api.image_create, self.context, fixture) @@ -257,18 +257,18 @@ class DriverTests(object): def test_image_create_bad_property(self): # bad value fixture = {'status': 'queued', - 'properties': {'bad': u'Bad \U0001f62a'}} + 'properties': {'bad': 'Bad \U0001f62a'}} self.assertRaises(exception.Invalid, self.db_api.image_create, self.context, fixture) # bad property names are also not allowed - fixture = {'status': 'queued', 'properties': {u'Bad \U0001f62a': 'ok'}} + fixture = {'status': 'queued', 'properties': {'Bad \U0001f62a': 'ok'}} self.assertRaises(exception.Invalid, self.db_api.image_create, self.context, fixture) def test_image_create_bad_location(self): location_data = [{'url': 'a', 'metadata': {'key': 'value'}, 'status': 'active'}, - {'url': u'Bad \U0001f60a', 'metadata': {}, + {'url': 'Bad \U0001f60a', 'metadata': {}, 'status': 'active'}] fixture = {'status': 'queued', 'locations': location_data} self.assertRaises(exception.Invalid, self.db_api.image_create, @@ -342,25 +342,25 @@ class DriverTests(object): self.assertTrue(properties['foo']['deleted']) def test_image_update_bad_name(self): - fixture = {'name': u'A new name with forbidden symbol \U0001f62a'} + fixture = {'name': 'A new name with forbidden symbol \U0001f62a'} self.assertRaises(exception.Invalid, self.db_api.image_update, self.adm_context, UUID1, fixture) def test_image_update_bad_property(self): # bad value fixture = {'status': 'queued', - 'properties': {'bad': u'Bad \U0001f62a'}} + 'properties': {'bad': 'Bad \U0001f62a'}} self.assertRaises(exception.Invalid, self.db_api.image_update, self.adm_context, UUID1, fixture) # bad property names are also not allowed - fixture = {'status': 'queued', 'properties': {u'Bad \U0001f62a': 'ok'}} + fixture = {'status': 'queued', 'properties': {'Bad \U0001f62a': 'ok'}} self.assertRaises(exception.Invalid, self.db_api.image_update, self.adm_context, UUID1, fixture) def test_image_update_bad_location(self): location_data = [{'url': 'a', 'metadata': {'key': 'value'}, 'status': 'active'}, - {'url': u'Bad \U0001f60a', 'metadata': {}, + {'url': 'Bad \U0001f60a', 'metadata': {}, 'status': 'active'}] fixture = {'status': 'queued', 'locations': location_data} self.assertRaises(exception.Invalid, self.db_api.image_update, @@ -380,7 +380,7 @@ class DriverTests(object): self.assertEqual(1, len(image['locations'])) self.assertIn('id', image['locations'][0]) loc_id = image['locations'][0].pop('id') - bad_location = {'url': u'Bad \U0001f60a', 'metadata': {}, + bad_location = {'url': 'Bad \U0001f60a', 'metadata': {}, 'status': 'active', 'id': loc_id} self.assertRaises(exception.Invalid, self.db_api.image_location_update, @@ -1201,7 +1201,7 @@ class DriverTests(object): def test_image_tag_create_bad_value(self): self.assertRaises(exception.Invalid, self.db_api.image_tag_create, self.context, - UUID1, u'Bad \U0001f62a') + UUID1, 'Bad \U0001f62a') def test_image_tag_set_all(self): tags = self.db_api.image_tag_get_all(self.context, UUID1) diff --git a/glance/tests/functional/db/base_metadef.py b/glance/tests/functional/db/base_metadef.py index 9762c02aff..47388dae92 100644 --- a/glance/tests/functional/db/base_metadef.py +++ b/glance/tests/functional/db/base_metadef.py @@ -23,12 +23,12 @@ from glance.tests import utils as test_utils def build_namespace_fixture(**kwargs): namespace = { - 'namespace': u'MyTestNamespace', - 'display_name': u'test-display-name', - 'description': u'test-description', - 'visibility': u'public', + 'namespace': 'MyTestNamespace', + 'display_name': 'test-display-name', + 'description': 'test-description', + 'visibility': 'public', 'protected': 0, - 'owner': u'test-owner' + 'owner': 'test-owner' } namespace.update(kwargs) return namespace @@ -36,7 +36,7 @@ def build_namespace_fixture(**kwargs): def build_resource_type_fixture(**kwargs): resource_type = { - 'name': u'MyTestResourceType', + 'name': 'MyTestResourceType', 'protected': 0 } resource_type.update(kwargs) @@ -45,7 +45,7 @@ def build_resource_type_fixture(**kwargs): def build_association_fixture(**kwargs): association = { - 'name': u'MyTestResourceType', + 'name': 'MyTestResourceType', 'properties_target': 'test-properties-target', 'prefix': 'test-prefix' } @@ -57,10 +57,10 @@ def build_object_fixture(**kwargs): # Full testing of required and schema done via rest api tests object = { 'namespace_id': 1, - 'name': u'test-object-name', - 'description': u'test-object-description', - 'required': u'fake-required-properties-list', - 'json_schema': u'{fake-schema}' + 'name': 'test-object-name', + 'description': 'test-object-description', + 'required': 'fake-required-properties-list', + 'json_schema': '{fake-schema}' } object.update(kwargs) return object @@ -70,8 +70,8 @@ def build_property_fixture(**kwargs): # Full testing of required and schema done via rest api tests property = { 'namespace_id': 1, - 'name': u'test-property-name', - 'json_schema': u'{fake-schema}' + 'name': 'test-property-name', + 'json_schema': '{fake-schema}' } property.update(kwargs) return property @@ -81,7 +81,7 @@ def build_tag_fixture(**kwargs): # Full testing of required and schema done via rest api tests tag = { 'namespace_id': 1, - 'name': u'test-tag-name', + 'name': 'test-tag-name', } tag.update(kwargs) return tag @@ -162,7 +162,7 @@ class MetadefNamespaceTests(object): self._assert_saved_fields(ns_fixture, item) def test_namespace_update(self): - delta = {'owner': u'New Owner'} + delta = {'owner': 'New Owner'} fixture = build_namespace_fixture() created = self.db_api.metadef_namespace_create(self.context, fixture) @@ -285,7 +285,7 @@ class MetadefPropertyTests(object): self.assertEqual(2, len(found)) def test_property_update(self): - delta = {'name': u'New-name', 'json_schema': u'new-schema'} + delta = {'name': 'New-name', 'json_schema': 'new-schema'} fixture_ns = build_namespace_fixture() created_ns = self.db_api.metadef_namespace_create( @@ -412,8 +412,8 @@ class MetadefObjectTests(object): self.assertEqual(2, len(found)) def test_object_update(self): - delta = {'name': u'New-name', 'json_schema': u'new-schema', - 'required': u'new-required'} + delta = {'name': 'New-name', 'json_schema': 'new-schema', + 'required': 'new-required'} fixture_ns = build_namespace_fixture() created_ns = self.db_api.metadef_namespace_create(self.context, @@ -701,7 +701,7 @@ class MetadefTagTests(object): self.assertEqual(2, len(found)) def test_tag_update(self): - delta = {'name': u'New-name'} + delta = {'name': 'New-name'} fixture_ns = build_namespace_fixture() created_ns = self.db_api.metadef_namespace_create(self.context, diff --git a/glance/tests/functional/v2/test_images.py b/glance/tests/functional/v2/test_images.py index b1de8c029f..bbe1a00909 100644 --- a/glance/tests/functional/v2/test_images.py +++ b/glance/tests/functional/v2/test_images.py @@ -125,29 +125,29 @@ class TestImages(functional.FunctionalTest): image = jsonutils.loads(response.text) image_id = image['id'] checked_keys = set([ - u'status', - u'name', - u'tags', - u'created_at', - u'updated_at', - u'visibility', - u'self', - u'protected', - u'os_hidden', - u'id', - u'file', - u'min_disk', - u'type', - u'min_ram', - u'schema', - u'disk_format', - u'container_format', - u'owner', - u'checksum', - u'os_hash_algo', - u'os_hash_value', - u'size', - u'virtual_size', + 'status', + 'name', + 'tags', + 'created_at', + 'updated_at', + 'visibility', + 'self', + 'protected', + 'os_hidden', + 'id', + 'file', + 'min_disk', + 'type', + 'min_ram', + 'schema', + 'disk_format', + 'container_format', + 'owner', + 'checksum', + 'os_hash_algo', + 'os_hash_value', + 'size', + 'virtual_size', ]) self.assertEqual(checked_keys, set(image.keys())) expected_image = { @@ -267,29 +267,29 @@ class TestImages(functional.FunctionalTest): image = jsonutils.loads(response.text) image_id = image['id'] checked_keys = set([ - u'status', - u'name', - u'tags', - u'created_at', - u'updated_at', - u'visibility', - u'self', - u'protected', - u'os_hidden', - u'id', - u'file', - u'min_disk', - u'type', - u'min_ram', - u'schema', - u'disk_format', - u'container_format', - u'owner', - u'checksum', - u'os_hash_algo', - u'os_hash_value', - u'size', - u'virtual_size', + 'status', + 'name', + 'tags', + 'created_at', + 'updated_at', + 'visibility', + 'self', + 'protected', + 'os_hidden', + 'id', + 'file', + 'min_disk', + 'type', + 'min_ram', + 'schema', + 'disk_format', + 'container_format', + 'owner', + 'checksum', + 'os_hash_algo', + 'os_hash_value', + 'size', + 'virtual_size', ]) self.assertEqual(checked_keys, set(image.keys())) expected_image = { @@ -402,32 +402,32 @@ class TestImages(functional.FunctionalTest): image = jsonutils.loads(response.text) image_id = image['id'] checked_keys = set([ - u'status', - u'name', - u'tags', - u'created_at', - u'updated_at', - u'visibility', - u'self', - u'protected', - u'os_hidden', - u'id', - u'file', - u'min_disk', - u'foo', - u'abc', - u'type', - u'min_ram', - u'schema', - u'disk_format', - u'container_format', - u'owner', - u'checksum', - u'os_hash_algo', - u'os_hash_value', - u'size', - u'virtual_size', - u'locations', + 'status', + 'name', + 'tags', + 'created_at', + 'updated_at', + 'visibility', + 'self', + 'protected', + 'os_hidden', + 'id', + 'file', + 'min_disk', + 'foo', + 'abc', + 'type', + 'min_ram', + 'schema', + 'disk_format', + 'container_format', + 'owner', + 'checksum', + 'os_hash_algo', + 'os_hash_value', + 'size', + 'virtual_size', + 'locations', ]) self.assertEqual(checked_keys, set(image.keys())) expected_image = { @@ -469,32 +469,32 @@ class TestImages(functional.FunctionalTest): image = jsonutils.loads(response.text) image2_id = image['id'] checked_keys = set([ - u'status', - u'name', - u'tags', - u'created_at', - u'updated_at', - u'visibility', - u'self', - u'protected', - u'os_hidden', - u'id', - u'file', - u'min_disk', - u'bar', - u'xyz', - u'type', - u'min_ram', - u'schema', - u'disk_format', - u'container_format', - u'owner', - u'checksum', - u'os_hash_algo', - u'os_hash_value', - u'size', - u'virtual_size', - u'locations', + 'status', + 'name', + 'tags', + 'created_at', + 'updated_at', + 'visibility', + 'self', + 'protected', + 'os_hidden', + 'id', + 'file', + 'min_disk', + 'bar', + 'xyz', + 'type', + 'min_ram', + 'schema', + 'disk_format', + 'container_format', + 'owner', + 'checksum', + 'os_hash_algo', + 'os_hash_value', + 'size', + 'virtual_size', + 'locations', ]) self.assertEqual(checked_keys, set(image.keys())) expected_image = { @@ -1021,30 +1021,30 @@ class TestImages(functional.FunctionalTest): image = jsonutils.loads(response.text) image_id = image['id'] checked_keys = set([ - u'status', - u'name', - u'tags', - u'created_at', - u'updated_at', - u'visibility', - u'self', - u'protected', - u'os_hidden', - u'id', - u'file', - u'min_disk', - u'type', - u'min_ram', - u'schema', - u'disk_format', - u'container_format', - u'owner', - u'checksum', - u'os_hash_algo', - u'os_hash_value', - u'size', - u'virtual_size', - u'locations', + 'status', + 'name', + 'tags', + 'created_at', + 'updated_at', + 'visibility', + 'self', + 'protected', + 'os_hidden', + 'id', + 'file', + 'min_disk', + 'type', + 'min_ram', + 'schema', + 'disk_format', + 'container_format', + 'owner', + 'checksum', + 'os_hash_algo', + 'os_hash_value', + 'size', + 'virtual_size', + 'locations', ]) self.assertEqual(checked_keys, set(image.keys())) @@ -1088,30 +1088,30 @@ class TestImages(functional.FunctionalTest): image = jsonutils.loads(response.text) image2_id = image['id'] checked_keys = set([ - u'status', - u'name', - u'tags', - u'created_at', - u'updated_at', - u'visibility', - u'self', - u'protected', - u'os_hidden', - u'id', - u'file', - u'min_disk', - u'type', - u'min_ram', - u'schema', - u'disk_format', - u'container_format', - u'owner', - u'checksum', - u'os_hash_algo', - u'os_hash_value', - u'size', - u'virtual_size', - u'locations', + 'status', + 'name', + 'tags', + 'created_at', + 'updated_at', + 'visibility', + 'self', + 'protected', + 'os_hidden', + 'id', + 'file', + 'min_disk', + 'type', + 'min_ram', + 'schema', + 'disk_format', + 'container_format', + 'owner', + 'checksum', + 'os_hash_algo', + 'os_hash_value', + 'size', + 'virtual_size', + 'locations', ]) self.assertEqual(checked_keys, set(image.keys())) @@ -4564,29 +4564,29 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest): image = jsonutils.loads(response.text) image_id = image['id'] checked_keys = set([ - u'status', - u'name', - u'tags', - u'created_at', - u'updated_at', - u'visibility', - u'self', - u'protected', - u'id', - u'file', - u'min_disk', - u'type', - u'min_ram', - u'schema', - u'disk_format', - u'container_format', - u'owner', - u'checksum', - u'size', - u'virtual_size', - u'os_hidden', - u'os_hash_algo', - u'os_hash_value' + 'status', + 'name', + 'tags', + 'created_at', + 'updated_at', + 'visibility', + 'self', + 'protected', + 'id', + 'file', + 'min_disk', + 'type', + 'min_ram', + 'schema', + 'disk_format', + 'container_format', + 'owner', + 'checksum', + 'size', + 'virtual_size', + 'os_hidden', + 'os_hash_algo', + 'os_hash_value' ]) self.assertEqual(checked_keys, set(image.keys())) @@ -4729,29 +4729,29 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest): image = jsonutils.loads(response.text) image_id = image['id'] checked_keys = set([ - u'status', - u'name', - u'tags', - u'created_at', - u'updated_at', - u'visibility', - u'self', - u'protected', - u'id', - u'file', - u'min_disk', - u'type', - u'min_ram', - u'schema', - u'disk_format', - u'container_format', - u'owner', - u'checksum', - u'size', - u'virtual_size', - u'os_hidden', - u'os_hash_algo', - u'os_hash_value' + 'status', + 'name', + 'tags', + 'created_at', + 'updated_at', + 'visibility', + 'self', + 'protected', + 'id', + 'file', + 'min_disk', + 'type', + 'min_ram', + 'schema', + 'disk_format', + 'container_format', + 'owner', + 'checksum', + 'size', + 'virtual_size', + 'os_hidden', + 'os_hash_algo', + 'os_hash_value' ]) self.assertEqual(checked_keys, set(image.keys())) expected_image = { @@ -4894,29 +4894,29 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest): image = jsonutils.loads(response.text) image_id = image['id'] checked_keys = set([ - u'status', - u'name', - u'tags', - u'created_at', - u'updated_at', - u'visibility', - u'self', - u'protected', - u'id', - u'file', - u'min_disk', - u'type', - u'min_ram', - u'schema', - u'disk_format', - u'container_format', - u'owner', - u'checksum', - u'size', - u'virtual_size', - u'os_hidden', - u'os_hash_algo', - u'os_hash_value' + 'status', + 'name', + 'tags', + 'created_at', + 'updated_at', + 'visibility', + 'self', + 'protected', + 'id', + 'file', + 'min_disk', + 'type', + 'min_ram', + 'schema', + 'disk_format', + 'container_format', + 'owner', + 'checksum', + 'size', + 'virtual_size', + 'os_hidden', + 'os_hash_algo', + 'os_hash_value' ]) self.assertEqual(checked_keys, set(image.keys())) expected_image = { @@ -5057,29 +5057,29 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest): image = jsonutils.loads(response.text) image_id = image['id'] checked_keys = set([ - u'status', - u'name', - u'tags', - u'created_at', - u'updated_at', - u'visibility', - u'self', - u'protected', - u'id', - u'file', - u'min_disk', - u'type', - u'min_ram', - u'schema', - u'disk_format', - u'container_format', - u'owner', - u'checksum', - u'size', - u'virtual_size', - u'os_hidden', - u'os_hash_algo', - u'os_hash_value' + 'status', + 'name', + 'tags', + 'created_at', + 'updated_at', + 'visibility', + 'self', + 'protected', + 'id', + 'file', + 'min_disk', + 'type', + 'min_ram', + 'schema', + 'disk_format', + 'container_format', + 'owner', + 'checksum', + 'size', + 'virtual_size', + 'os_hidden', + 'os_hash_algo', + 'os_hash_value' ]) self.assertEqual(checked_keys, set(image.keys())) expected_image = { @@ -5221,29 +5221,29 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest): image = jsonutils.loads(response.text) image_id = image['id'] checked_keys = set([ - u'status', - u'name', - u'tags', - u'created_at', - u'updated_at', - u'visibility', - u'self', - u'protected', - u'id', - u'file', - u'min_disk', - u'type', - u'min_ram', - u'schema', - u'disk_format', - u'container_format', - u'owner', - u'checksum', - u'size', - u'virtual_size', - u'os_hidden', - u'os_hash_algo', - u'os_hash_value' + 'status', + 'name', + 'tags', + 'created_at', + 'updated_at', + 'visibility', + 'self', + 'protected', + 'id', + 'file', + 'min_disk', + 'type', + 'min_ram', + 'schema', + 'disk_format', + 'container_format', + 'owner', + 'checksum', + 'size', + 'virtual_size', + 'os_hidden', + 'os_hash_algo', + 'os_hash_value' ]) self.assertEqual(checked_keys, set(image.keys())) expected_image = { @@ -5384,29 +5384,29 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest): image = jsonutils.loads(response.text) image_id = image['id'] checked_keys = set([ - u'status', - u'name', - u'tags', - u'created_at', - u'updated_at', - u'visibility', - u'self', - u'protected', - u'id', - u'file', - u'min_disk', - u'type', - u'min_ram', - u'schema', - u'disk_format', - u'container_format', - u'owner', - u'checksum', - u'size', - u'virtual_size', - u'os_hidden', - u'os_hash_algo', - u'os_hash_value' + 'status', + 'name', + 'tags', + 'created_at', + 'updated_at', + 'visibility', + 'self', + 'protected', + 'id', + 'file', + 'min_disk', + 'type', + 'min_ram', + 'schema', + 'disk_format', + 'container_format', + 'owner', + 'checksum', + 'size', + 'virtual_size', + 'os_hidden', + 'os_hash_algo', + 'os_hash_value' ]) self.assertEqual(checked_keys, set(image.keys())) expected_image = { @@ -5609,29 +5609,29 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest): image = jsonutils.loads(response.text) image_id = image['id'] checked_keys = set([ - u'status', - u'name', - u'tags', - u'created_at', - u'updated_at', - u'visibility', - u'self', - u'protected', - u'id', - u'file', - u'min_disk', - u'type', - u'min_ram', - u'schema', - u'disk_format', - u'container_format', - u'owner', - u'checksum', - u'size', - u'virtual_size', - u'os_hidden', - u'os_hash_algo', - u'os_hash_value' + 'status', + 'name', + 'tags', + 'created_at', + 'updated_at', + 'visibility', + 'self', + 'protected', + 'id', + 'file', + 'min_disk', + 'type', + 'min_ram', + 'schema', + 'disk_format', + 'container_format', + 'owner', + 'checksum', + 'size', + 'virtual_size', + 'os_hidden', + 'os_hash_algo', + 'os_hash_value' ]) self.assertEqual(checked_keys, set(image.keys())) expected_image = { @@ -5867,29 +5867,29 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest): image = jsonutils.loads(response.text) image_id = image['id'] checked_keys = set([ - u'status', - u'name', - u'tags', - u'created_at', - u'updated_at', - u'visibility', - u'self', - u'protected', - u'id', - u'file', - u'min_disk', - u'type', - u'min_ram', - u'schema', - u'disk_format', - u'container_format', - u'owner', - u'checksum', - u'size', - u'virtual_size', - u'os_hidden', - u'os_hash_algo', - u'os_hash_value' + 'status', + 'name', + 'tags', + 'created_at', + 'updated_at', + 'visibility', + 'self', + 'protected', + 'id', + 'file', + 'min_disk', + 'type', + 'min_ram', + 'schema', + 'disk_format', + 'container_format', + 'owner', + 'checksum', + 'size', + 'virtual_size', + 'os_hidden', + 'os_hash_algo', + 'os_hash_value' ]) self.assertEqual(checked_keys, set(image.keys())) expected_image = { @@ -6023,31 +6023,31 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest): image = jsonutils.loads(response.text) image_id = image['id'] checked_keys = set([ - u'status', - u'name', - u'tags', - u'created_at', - u'updated_at', - u'visibility', - u'self', - u'protected', - u'id', - u'file', - u'min_disk', - u'foo', - u'abc', - u'type', - u'min_ram', - u'schema', - u'disk_format', - u'container_format', - u'owner', - u'checksum', - u'size', - u'virtual_size', - u'os_hidden', - u'os_hash_algo', - u'os_hash_value' + 'status', + 'name', + 'tags', + 'created_at', + 'updated_at', + 'visibility', + 'self', + 'protected', + 'id', + 'file', + 'min_disk', + 'foo', + 'abc', + 'type', + 'min_ram', + 'schema', + 'disk_format', + 'container_format', + 'owner', + 'checksum', + 'size', + 'virtual_size', + 'os_hidden', + 'os_hash_algo', + 'os_hash_value' ]) self.assertEqual(checked_keys, set(image.keys())) expected_image = { @@ -6193,31 +6193,31 @@ class TestImagesMultipleBackend(functional.MultipleBackendFunctionalTest): image = jsonutils.loads(response.text) image_id = image['id'] checked_keys = set([ - u'status', - u'name', - u'tags', - u'created_at', - u'updated_at', - u'visibility', - u'self', - u'protected', - u'id', - u'file', - u'min_disk', - u'foo', - u'abc', - u'type', - u'min_ram', - u'schema', - u'disk_format', - u'container_format', - u'owner', - u'checksum', - u'size', - u'virtual_size', - u'os_hidden', - u'os_hash_algo', - u'os_hash_value' + 'status', + 'name', + 'tags', + 'created_at', + 'updated_at', + 'visibility', + 'self', + 'protected', + 'id', + 'file', + 'min_disk', + 'foo', + 'abc', + 'type', + 'min_ram', + 'schema', + 'disk_format', + 'container_format', + 'owner', + 'checksum', + 'size', + 'virtual_size', + 'os_hidden', + 'os_hash_algo', + 'os_hash_value' ]) self.assertEqual(checked_keys, set(image.keys())) diff --git a/glance/tests/functional/v2/test_metadef_namespaces.py b/glance/tests/functional/v2/test_metadef_namespaces.py index cecbc00630..328620be28 100644 --- a/glance/tests/functional/v2/test_metadef_namespaces.py +++ b/glance/tests/functional/v2/test_metadef_namespaces.py @@ -54,16 +54,16 @@ class TestNamespaces(metadef_base.MetadefFunctionalTestBase): # Tenant namespace = jsonutils.loads(response.text) checked_keys = set([ - u'namespace', - u'display_name', - u'description', - u'visibility', - u'self', - u'schema', - u'protected', - u'owner', - u'created_at', - u'updated_at' + 'namespace', + 'display_name', + 'description', + 'visibility', + 'self', + 'schema', + 'protected', + 'owner', + 'created_at', + 'updated_at' ]) self.assertEqual(set(namespace.keys()), checked_keys) expected_namespace = { diff --git a/glance/tests/functional/v2/test_metadef_objects.py b/glance/tests/functional/v2/test_metadef_objects.py index 3e45017aa9..e736a453cb 100644 --- a/glance/tests/functional/v2/test_metadef_objects.py +++ b/glance/tests/functional/v2/test_metadef_objects.py @@ -107,14 +107,14 @@ class TestMetadefObjects(metadef_base.MetadefFunctionalTestBase): # Returned object should match the created object metadata_object = jsonutils.loads(response.text) checked_keys = set([ - u'name', - u'description', - u'properties', - u'required', - u'self', - u'schema', - u'created_at', - u'updated_at' + 'name', + 'description', + 'properties', + 'required', + 'self', + 'schema', + 'created_at', + 'updated_at' ]) self.assertEqual(set(metadata_object.keys()), checked_keys) expected_metadata_object = { @@ -151,8 +151,8 @@ class TestMetadefObjects(metadef_base.MetadefFunctionalTestBase): # Simple key values checked_values = set([ - u'name', - u'description', + 'name', + 'description', ]) for key, value in expected_metadata_object.items(): if(key in checked_values): diff --git a/glance/tests/functional/v2/test_metadef_properties.py b/glance/tests/functional/v2/test_metadef_properties.py index 4328e5a812..262de65dd1 100644 --- a/glance/tests/functional/v2/test_metadef_properties.py +++ b/glance/tests/functional/v2/test_metadef_properties.py @@ -129,14 +129,14 @@ class TestNamespaceProperties(metadef_base.MetadefFunctionalTestBase): # Returned property should match the created property property_object = jsonutils.loads(response.text) checked_keys = set([ - u'name', - u'type', - u'title', - u'description', - u'default', - u'minimum', - u'maximum', - u'readonly', + 'name', + 'type', + 'title', + 'description', + 'default', + 'minimum', + 'maximum', + 'readonly', ]) self.assertEqual(set(property_object.keys()), checked_keys) expected_metadata_property = { diff --git a/glance/tests/functional/v2/test_metadef_tags.py b/glance/tests/functional/v2/test_metadef_tags.py index 6548db7a51..2e42922a9f 100644 --- a/glance/tests/functional/v2/test_metadef_tags.py +++ b/glance/tests/functional/v2/test_metadef_tags.py @@ -72,9 +72,9 @@ class TestMetadefTags(metadef_base.MetadefFunctionalTestBase): # Returned tag should match the created tag metadata_tag = jsonutils.loads(response.text) checked_keys = set([ - u'name', - u'created_at', - u'updated_at' + 'name', + 'created_at', + 'updated_at' ]) self.assertEqual(checked_keys, set(metadata_tag.keys())) expected_metadata_tag = { @@ -83,7 +83,7 @@ class TestMetadefTags(metadef_base.MetadefFunctionalTestBase): # Simple key values checked_values = set([ - u'name' + 'name' ]) for key, value in expected_metadata_tag.items(): if(key in checked_values): diff --git a/glance/tests/functional/v2/test_tasks.py b/glance/tests/functional/v2/test_tasks.py index 2168c65413..20cb2dfb7e 100644 --- a/glance/tests/functional/v2/test_tasks.py +++ b/glance/tests/functional/v2/test_tasks.py @@ -89,19 +89,19 @@ class TestTasks(functional.FunctionalTest): self.assertIn('Location', response.headers) self.assertEqual(path + '/' + task_id, response.headers['Location']) - checked_keys = set([u'created_at', - u'id', - u'input', - u'message', - u'owner', - u'schema', - u'self', - u'status', - u'type', - u'result', - u'updated_at', - u'request_id', - u'user_id', + checked_keys = set(['created_at', + 'id', + 'input', + 'message', + 'owner', + 'schema', + 'self', + 'status', + 'type', + 'result', + 'updated_at', + 'request_id', + 'user_id' ]) self.assertEqual(checked_keys, set(task.keys())) expected_task = { diff --git a/glance/tests/unit/common/test_client.py b/glance/tests/unit/common/test_client.py index 650a33fc21..b94cad692e 100644 --- a/glance/tests/unit/common/test_client.py +++ b/glance/tests/unit/common/test_client.py @@ -29,7 +29,7 @@ class TestClient(testtools.TestCase): super(TestClient, self).setUp() self.endpoint = 'example.com' self.client = client.BaseClient(self.endpoint, port=9191, - auth_token=u'abc123') + auth_token='abc123') def tearDown(self): super(TestClient, self).tearDown() @@ -49,7 +49,7 @@ class TestClient(testtools.TestCase): fake = utils.FakeHTTPResponse(data=b"Ok") _mock_resp.return_value = fake - headers = {"test": u'ni\xf1o'} + headers = {"test": 'ni\xf1o'} resp = self.client.do_request('GET', '/v1/images/detail', headers=headers) self.assertEqual(fake, resp) @@ -62,7 +62,7 @@ class TestClient(testtools.TestCase): fake = utils.FakeHTTPResponse(data=b"Ok") _mock_resp.return_value = fake - params = {"test": u'ni\xf1o'} + params = {"test": 'ni\xf1o'} resp = self.client.do_request('GET', '/v1/images/detail', params=params) self.assertEqual(fake, resp) diff --git a/glance/tests/unit/common/test_utils.py b/glance/tests/unit/common/test_utils.py index 0c89f62990..15fb09c1a8 100644 --- a/glance/tests/unit/common/test_utils.py +++ b/glance/tests/unit/common/test_utils.py @@ -348,8 +348,8 @@ class TestUtils(test_utils.BaseTestCase): actual = utils.image_meta_to_http_headers(image_meta) actual_test2 = utils.image_meta_to_http_headers( image_meta_properties) - self.assertEqual({'x-image-meta-x-image-meta-size': u'test'}, actual) - self.assertEqual({'x-image-meta-property-test': u'test'}, + self.assertEqual({'x-image-meta-x-image-meta-size': 'test'}, actual) + self.assertEqual({'x-image-meta-property-test': 'test'}, actual_test2) def test_create_mashup_dict_with_different_core_custom_properties(self): @@ -435,7 +435,7 @@ class TestUtils(test_utils.BaseTestCase): def test_valid_hostname_fail(self): invalid_inputs = ['localhost.localdomain', '192.168.0.1', - u'\u2603', + '\u2603', 'glance02.stack42.local'] for input_str in invalid_inputs: @@ -454,7 +454,7 @@ class TestUtils(test_utils.BaseTestCase): invalid_inputs = ['localhost', '192.168.0.1', '999.88.77.6', - u'\u2603.local', + '\u2603.local', 'glance02.stack42'] for input_str in invalid_inputs: @@ -489,8 +489,8 @@ class TestUtils(test_utils.BaseTestCase): '172.17.17.1:99999', '290.12.52.80:5673', 'absurd inputs happen', - u'\u2601', - u'\u2603:8080', + '\u2601', + '\u2603:8080', 'fe80::1', '[fe80::2]', ':5673', diff --git a/glance/tests/unit/common/test_wsgi.py b/glance/tests/unit/common/test_wsgi.py index 1c22477153..9c3891e3e4 100644 --- a/glance/tests/unit/common/test_wsgi.py +++ b/glance/tests/unit/common/test_wsgi.py @@ -380,8 +380,8 @@ class ResourceTest(test_utils.BaseTestCase): def test_response_headers_encoded(self): # prepare environment for_openstack_comrades = ( - u'\u0417\u0430 \u043e\u043f\u0435\u043d\u0441\u0442\u0435\u043a, ' - u'\u0442\u043e\u0432\u0430\u0440\u0438\u0449\u0438') + '\u0417\u0430 \u043e\u043f\u0435\u043d\u0441\u0442\u0435\u043a, ' + '\u0442\u043e\u0432\u0430\u0440\u0438\u0449\u0438') class FakeController(object): def index(self, shirt, pants=None): diff --git a/glance/tests/unit/test_store_image.py b/glance/tests/unit/test_store_image.py index 8629ab66a9..50bda54a21 100644 --- a/glance/tests/unit/test_store_image.py +++ b/glance/tests/unit/test_store_image.py @@ -164,7 +164,7 @@ class TestStoreMultiBackends(utils.BaseTestCase): store_api, self.store_utils) image.set_data('YYYY', 4, backend='ceph1') self.assertEqual('active', image.status) - call = mock.call(u'Successfully verified signature for image %s', + call = mock.call('Successfully verified signature for image %s', UUID2) mock_log.info.assert_has_calls([call]) @@ -362,7 +362,7 @@ class TestStoreImage(utils.BaseTestCase): image.set_data('YYYY', 4) self.assertEqual('active', image.status) mock_log.info.assert_any_call( - u'Successfully verified signature for image %s', + 'Successfully verified signature for image %s', UUID2) def test_image_set_data_invalid_signature(self): @@ -1035,25 +1035,25 @@ class TestStoreMetaDataChecker(utils.BaseTestCase): glance_store.check_location_metadata({}) def test_unicode(self): - m = {'key': u'somevalue'} + m = {'key': 'somevalue'} glance_store.check_location_metadata(m) def test_unicode_list(self): - m = {'key': [u'somevalue', u'2']} + m = {'key': ['somevalue', '2']} glance_store.check_location_metadata(m) def test_unicode_dict(self): - inner = {'key1': u'somevalue', 'key2': u'somevalue'} + inner = {'key1': 'somevalue', 'key2': 'somevalue'} m = {'topkey': inner} glance_store.check_location_metadata(m) def test_unicode_dict_list(self): - inner = {'key1': u'somevalue', 'key2': u'somevalue'} - m = {'topkey': inner, 'list': [u'somevalue', u'2'], 'u': u'2'} + inner = {'key1': 'somevalue', 'key2': 'somevalue'} + m = {'topkey': inner, 'list': ['somevalue', '2'], 'u': '2'} glance_store.check_location_metadata(m) def test_nested_dict(self): - inner = {'key1': u'somevalue', 'key2': u'somevalue'} + inner = {'key1': 'somevalue', 'key2': 'somevalue'} inner = {'newkey': inner} inner = {'anotherkey': inner} m = {'topkey': inner} @@ -1066,13 +1066,13 @@ class TestStoreMetaDataChecker(utils.BaseTestCase): m) def test_list_bad(self): - m = {'key1': [u'somevalue', object()]} + m = {'key1': ['somevalue', object()]} self.assertRaises(glance_store.BackendException, glance_store.check_location_metadata, m) def test_nested_dict_bad(self): - inner = {'key1': u'somevalue', 'key2': object()} + inner = {'key1': 'somevalue', 'key2': object()} inner = {'newkey': inner} inner = {'anotherkey': inner} m = {'topkey': inner} diff --git a/glance/tests/unit/v2/test_image_members_resource.py b/glance/tests/unit/v2/test_image_members_resource.py index f9aad85476..457b8505d5 100644 --- a/glance/tests/unit/v2/test_image_members_resource.py +++ b/glance/tests/unit/v2/test_image_members_resource.py @@ -283,7 +283,7 @@ class TestImageMembersController(test_utils.BaseTestCase): request = unit_test_utils.get_fake_request() self.assertRaises(webob.exc.HTTPBadRequest, self.controller.create, request, image_id=UUID5, - member_id=u'\U0001f693') + member_id='\U0001f693') def test_update_done_by_member(self): request = unit_test_utils.get_fake_request(tenant=TENANT4) diff --git a/glance/tests/unit/v2/test_images_resource.py b/glance/tests/unit/v2/test_images_resource.py index 577c47eca5..67a6f36492 100644 --- a/glance/tests/unit/v2/test_images_resource.py +++ b/glance/tests/unit/v2/test_images_resource.py @@ -4404,9 +4404,9 @@ class TestImagesDeserializer(test_utils.BaseTestCase): def test_update_pointer_encoding(self): samples = { - '/keywith~1slash': [u'keywith/slash'], - '/keywith~0tilde': [u'keywith~tilde'], - '/tricky~01': [u'tricky~1'], + '/keywith~1slash': ['keywith/slash'], + '/keywith~0tilde': ['keywith~tilde'], + '/tricky~01': ['tricky~1'], } for encoded, decoded in samples.items(): @@ -5349,10 +5349,10 @@ class TestImagesSerializerWithUnicode(test_utils.BaseTestCase): self.fixtures = [ # NOTE(bcwaldon): This first fixture has every property defined _domain_fixture(UUID1, **{ - 'name': u'OpenStack\u2122-1', + 'name': 'OpenStack\u2122-1', 'size': 1024, 'virtual_size': 3072, - 'tags': [u'\u2160', u'\u2161'], + 'tags': ['\u2160', '\u2161'], 'created_at': DATETIME, 'updated_at': DATETIME, 'owner': TENANT1, @@ -5361,50 +5361,50 @@ class TestImagesSerializerWithUnicode(test_utils.BaseTestCase): 'disk_format': 'ami', 'min_ram': 128, 'min_disk': 10, - 'checksum': u'ca425b88f047ce8ec45ee90e813ada91', + 'checksum': 'ca425b88f047ce8ec45ee90e813ada91', 'os_hash_algo': FAKEHASHALGO, 'os_hash_value': MULTIHASH1, - 'extra_properties': {'lang': u'Fran\u00E7ais', - u'dispos\u00E9': u'f\u00E2ch\u00E9'}, + 'extra_properties': {'lang': 'Fran\u00E7ais', + 'dispos\u00E9': 'f\u00E2ch\u00E9'}, }), ] def test_index(self): expected = { - u'images': [ + 'images': [ { - u'id': UUID1, - u'name': u'OpenStack\u2122-1', - u'status': u'queued', - u'visibility': u'public', - u'protected': False, - u'os_hidden': False, - u'tags': [u'\u2160', u'\u2161'], - u'size': 1024, - u'virtual_size': 3072, - u'checksum': u'ca425b88f047ce8ec45ee90e813ada91', - u'os_hash_algo': str(FAKEHASHALGO), - u'os_hash_value': str(MULTIHASH1), - u'container_format': u'ami', - u'disk_format': u'ami', - u'min_ram': 128, - u'min_disk': 10, - u'created_at': str(ISOTIME), - u'updated_at': str(ISOTIME), - u'self': u'/v2/images/%s' % UUID1, - u'file': u'/v2/images/%s/file' % UUID1, - u'schema': u'/v2/schemas/image', - u'lang': u'Fran\u00E7ais', - u'dispos\u00E9': u'f\u00E2ch\u00E9', - u'owner': u'6838eb7b-6ded-434a-882c-b344c77fe8df', + 'id': UUID1, + 'name': 'OpenStack\u2122-1', + 'status': 'queued', + 'visibility': 'public', + 'protected': False, + 'os_hidden': False, + 'tags': ['\u2160', '\u2161'], + 'size': 1024, + 'virtual_size': 3072, + 'checksum': 'ca425b88f047ce8ec45ee90e813ada91', + 'os_hash_algo': str(FAKEHASHALGO), + 'os_hash_value': str(MULTIHASH1), + 'container_format': 'ami', + 'disk_format': 'ami', + 'min_ram': 128, + 'min_disk': 10, + 'created_at': str(ISOTIME), + 'updated_at': str(ISOTIME), + 'self': '/v2/images/%s' % UUID1, + 'file': '/v2/images/%s/file' % UUID1, + 'schema': '/v2/schemas/image', + 'lang': 'Fran\u00E7ais', + 'dispos\u00E9': 'f\u00E2ch\u00E9', + 'owner': '6838eb7b-6ded-434a-882c-b344c77fe8df', }, ], - u'first': u'/v2/images', - u'schema': u'/v2/schemas/images', + 'first': '/v2/images', + 'schema': '/v2/schemas/images', } request = webob.Request.blank('/v2/images') response = webob.Response(request=request) - result = {u'images': self.fixtures} + result = {'images': self.fixtures} self.serializer.index(response, result) actual = jsonutils.loads(response.body) actual['images'][0]['tags'] = sorted(actual['images'][0]['tags']) @@ -5413,30 +5413,30 @@ class TestImagesSerializerWithUnicode(test_utils.BaseTestCase): def test_show_full_fixture(self): expected = { - u'id': UUID1, - u'name': u'OpenStack\u2122-1', - u'status': u'queued', - u'visibility': u'public', - u'protected': False, - u'os_hidden': False, - u'tags': set([u'\u2160', u'\u2161']), - u'size': 1024, - u'virtual_size': 3072, - u'checksum': u'ca425b88f047ce8ec45ee90e813ada91', - u'os_hash_algo': str(FAKEHASHALGO), - u'os_hash_value': str(MULTIHASH1), - u'container_format': u'ami', - u'disk_format': u'ami', - u'min_ram': 128, - u'min_disk': 10, - u'created_at': str(ISOTIME), - u'updated_at': str(ISOTIME), - u'self': u'/v2/images/%s' % UUID1, - u'file': u'/v2/images/%s/file' % UUID1, - u'schema': u'/v2/schemas/image', - u'lang': u'Fran\u00E7ais', - u'dispos\u00E9': u'f\u00E2ch\u00E9', - u'owner': u'6838eb7b-6ded-434a-882c-b344c77fe8df', + 'id': UUID1, + 'name': 'OpenStack\u2122-1', + 'status': 'queued', + 'visibility': 'public', + 'protected': False, + 'os_hidden': False, + 'tags': set(['\u2160', '\u2161']), + 'size': 1024, + 'virtual_size': 3072, + 'checksum': 'ca425b88f047ce8ec45ee90e813ada91', + 'os_hash_algo': str(FAKEHASHALGO), + 'os_hash_value': str(MULTIHASH1), + 'container_format': 'ami', + 'disk_format': 'ami', + 'min_ram': 128, + 'min_disk': 10, + 'created_at': str(ISOTIME), + 'updated_at': str(ISOTIME), + 'self': '/v2/images/%s' % UUID1, + 'file': '/v2/images/%s/file' % UUID1, + 'schema': '/v2/schemas/image', + 'lang': 'Fran\u00E7ais', + 'dispos\u00E9': 'f\u00E2ch\u00E9', + 'owner': '6838eb7b-6ded-434a-882c-b344c77fe8df', } response = webob.Response() self.serializer.show(response, self.fixtures[0]) @@ -5447,30 +5447,30 @@ class TestImagesSerializerWithUnicode(test_utils.BaseTestCase): def test_create(self): expected = { - u'id': UUID1, - u'name': u'OpenStack\u2122-1', - u'status': u'queued', - u'visibility': u'public', - u'protected': False, - u'os_hidden': False, - u'tags': [u'\u2160', u'\u2161'], - u'size': 1024, - u'virtual_size': 3072, - u'checksum': u'ca425b88f047ce8ec45ee90e813ada91', - u'os_hash_algo': str(FAKEHASHALGO), - u'os_hash_value': str(MULTIHASH1), - u'container_format': u'ami', - u'disk_format': u'ami', - u'min_ram': 128, - u'min_disk': 10, - u'created_at': str(ISOTIME), - u'updated_at': str(ISOTIME), - u'self': u'/v2/images/%s' % UUID1, - u'file': u'/v2/images/%s/file' % UUID1, - u'schema': u'/v2/schemas/image', - u'lang': u'Fran\u00E7ais', - u'dispos\u00E9': u'f\u00E2ch\u00E9', - u'owner': u'6838eb7b-6ded-434a-882c-b344c77fe8df', + 'id': UUID1, + 'name': 'OpenStack\u2122-1', + 'status': 'queued', + 'visibility': 'public', + 'protected': False, + 'os_hidden': False, + 'tags': ['\u2160', '\u2161'], + 'size': 1024, + 'virtual_size': 3072, + 'checksum': 'ca425b88f047ce8ec45ee90e813ada91', + 'os_hash_algo': str(FAKEHASHALGO), + 'os_hash_value': str(MULTIHASH1), + 'container_format': 'ami', + 'disk_format': 'ami', + 'min_ram': 128, + 'min_disk': 10, + 'created_at': str(ISOTIME), + 'updated_at': str(ISOTIME), + 'self': '/v2/images/%s' % UUID1, + 'file': '/v2/images/%s/file' % UUID1, + 'schema': '/v2/schemas/image', + 'lang': 'Fran\u00E7ais', + 'dispos\u00E9': 'f\u00E2ch\u00E9', + 'owner': '6838eb7b-6ded-434a-882c-b344c77fe8df', } response = webob.Response() self.serializer.create(response, self.fixtures[0]) @@ -5483,30 +5483,30 @@ class TestImagesSerializerWithUnicode(test_utils.BaseTestCase): def test_update(self): expected = { - u'id': UUID1, - u'name': u'OpenStack\u2122-1', - u'status': u'queued', - u'visibility': u'public', - u'protected': False, - u'os_hidden': False, - u'tags': set([u'\u2160', u'\u2161']), - u'size': 1024, - u'virtual_size': 3072, - u'checksum': u'ca425b88f047ce8ec45ee90e813ada91', - u'os_hash_algo': str(FAKEHASHALGO), - u'os_hash_value': str(MULTIHASH1), - u'container_format': u'ami', - u'disk_format': u'ami', - u'min_ram': 128, - u'min_disk': 10, - u'created_at': str(ISOTIME), - u'updated_at': str(ISOTIME), - u'self': u'/v2/images/%s' % UUID1, - u'file': u'/v2/images/%s/file' % UUID1, - u'schema': u'/v2/schemas/image', - u'lang': u'Fran\u00E7ais', - u'dispos\u00E9': u'f\u00E2ch\u00E9', - u'owner': u'6838eb7b-6ded-434a-882c-b344c77fe8df', + 'id': UUID1, + 'name': 'OpenStack\u2122-1', + 'status': 'queued', + 'visibility': 'public', + 'protected': False, + 'os_hidden': False, + 'tags': set(['\u2160', '\u2161']), + 'size': 1024, + 'virtual_size': 3072, + 'checksum': 'ca425b88f047ce8ec45ee90e813ada91', + 'os_hash_algo': str(FAKEHASHALGO), + 'os_hash_value': str(MULTIHASH1), + 'container_format': 'ami', + 'disk_format': 'ami', + 'min_ram': 128, + 'min_disk': 10, + 'created_at': str(ISOTIME), + 'updated_at': str(ISOTIME), + 'self': '/v2/images/%s' % UUID1, + 'file': '/v2/images/%s/file' % UUID1, + 'schema': '/v2/schemas/image', + 'lang': 'Fran\u00E7ais', + 'dispos\u00E9': 'f\u00E2ch\u00E9', + 'owner': '6838eb7b-6ded-434a-882c-b344c77fe8df', } response = webob.Response() self.serializer.update(response, self.fixtures[0]) diff --git a/glance/tests/unit/v2/test_metadef_resources.py b/glance/tests/unit/v2/test_metadef_resources.py index 8e8f0e24bd..eb50b37848 100644 --- a/glance/tests/unit/v2/test_metadef_resources.py +++ b/glance/tests/unit/v2/test_metadef_resources.py @@ -405,7 +405,7 @@ class TestMetadefsControllers(base.IsolatedUnitTest): 'name': 'prop1', 'additionalItems': None, 'confidential': None, - 'title': u'title', + 'title': 'title', 'default': None, 'pattern': None, 'enum': None, @@ -417,7 +417,7 @@ class TestMetadefsControllers(base.IsolatedUnitTest): 'uniqueItems': None, 'maxLength': None, 'items': None, - 'type': u'string', + 'type': 'string', 'description': None }], 'required': [], @@ -457,7 +457,7 @@ class TestMetadefsControllers(base.IsolatedUnitTest): @mock.patch('glance.api.v2.metadef_namespaces.LOG') @mock.patch('glance.notifier.MetadefNamespaceRepoProxy.remove') def test_cleanup_namespace_exception(self, mock_remove, mock_log): - mock_remove.side_effect = Exception(u'Mock remove was called') + mock_remove.side_effect = Exception('Mock remove was called') fake_gateway = glance.gateway.Gateway(db_api=self.db, notifier=self.notifier, policy_enforcer=self.policy) @@ -471,8 +471,8 @@ class TestMetadefsControllers(base.IsolatedUnitTest): called_msg = 'Failed to delete namespace %(namespace)s.' \ 'Exception: %(exception)s' - called_args = {'exception': u'Mock remove was called', - 'namespace': u'FakeNamespace'} + called_args = {'exception': 'Mock remove was called', + 'namespace': 'FakeNamespace'} mock_log.error.assert_called_with((called_msg, called_args)) mock_remove.assert_called_once_with(mock.ANY) @@ -701,7 +701,7 @@ class TestMetadefsControllers(base.IsolatedUnitTest): request = unit_test_utils.get_fake_request(roles=['admin']) namespace = namespaces.Namespace() - namespace.namespace = u'\U0001f693' + namespace.namespace = '\U0001f693' self.assertRaises(webob.exc.HTTPBadRequest, self.namespace_controller.create, request, @@ -915,7 +915,7 @@ class TestMetadefsControllers(base.IsolatedUnitTest): request = unit_test_utils.get_fake_request(roles=['admin']) namespace = self.namespace_controller.show(request, NAMESPACE1) - namespace.namespace = u'\U0001f693' + namespace.namespace = '\U0001f693' self.assertRaises(webob.exc.HTTPBadRequest, self.namespace_controller.update, request, @@ -1095,7 +1095,7 @@ class TestMetadefsControllers(base.IsolatedUnitTest): request = unit_test_utils.get_fake_request(roles=['admin']) property = properties.PropertyType() - property.name = u'\U0001f693' + property.name = '\U0001f693' property.type = 'string' property.title = 'title' @@ -1289,7 +1289,7 @@ class TestMetadefsControllers(base.IsolatedUnitTest): property = self.property_controller.show(request, NAMESPACE3, PROPERTY1) - property.name = u'\U0001f693' + property.name = '\U0001f693' property.type = 'string' property.title = 'title' @@ -1522,7 +1522,7 @@ class TestMetadefsControllers(base.IsolatedUnitTest): request = unit_test_utils.get_fake_request(roles=['admin']) object = objects.MetadefObject() - object.name = u'\U0001f693' + object.name = '\U0001f693' object.required = [] object.properties = {} @@ -1638,7 +1638,7 @@ class TestMetadefsControllers(base.IsolatedUnitTest): request = unit_test_utils.get_fake_request(roles=['admin']) object = self.object_controller.show(request, NAMESPACE1, OBJECT1) - object.name = u'\U0001f693' + object.name = '\U0001f693' self.assertRaises(webob.exc.HTTPBadRequest, self.object_controller.update, request, @@ -2012,7 +2012,7 @@ class TestMetadefsControllers(base.IsolatedUnitTest): self.assertRaises(webob.exc.HTTPBadRequest, self.tag_controller.create, - request, NAMESPACE1, u'\U0001f693') + request, NAMESPACE1, '\U0001f693') def test_tag_create_tags(self): request = unit_test_utils.get_fake_request(roles=['admin']) @@ -2270,7 +2270,7 @@ class TestMetadefsControllers(base.IsolatedUnitTest): request = unit_test_utils.get_fake_request(roles=['admin']) tag = self.tag_controller.show(request, NAMESPACE1, TAG1) - tag.name = u'\U0001f693' + tag.name = '\U0001f693' self.assertRaises(webob.exc.HTTPBadRequest, self.tag_controller.update, request, tag, diff --git a/releasenotes/source/conf.py b/releasenotes/source/conf.py index 05a0e5b0c5..e0f18c8fa8 100644 --- a/releasenotes/source/conf.py +++ b/releasenotes/source/conf.py @@ -55,8 +55,8 @@ source_suffix = '.rst' master_doc = 'index' # General information about the project. -project = u'Glance Release Notes' -copyright = u'2015, Glance Developers' +project = 'Glance Release Notes' +copyright = '2015, Glance Developers' # Release notes are version independent, no need to set version and release release = '' @@ -206,8 +206,8 @@ latex_elements = { # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ('index', 'GlanceReleaseNotes.tex', u'Glance Release Notes Documentation', - u'Glance Developers', 'manual'), + ('index', 'GlanceReleaseNotes.tex', 'Glance Release Notes Documentation', + 'Glance Developers', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -236,8 +236,8 @@ latex_documents = [ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'glancereleasenotes', u'Glance Release Notes Documentation', - [u'Glance Developers'], 1) + ('index', 'glancereleasenotes', 'Glance Release Notes Documentation', + ['Glance Developers'], 1) ] # If true, show URL addresses after external links. @@ -250,8 +250,8 @@ man_pages = [ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'GlanceReleaseNotes', u'Glance Release Notes Documentation', - u'Glance Developers', 'GlanceReleaseNotes', + ('index', 'GlanceReleaseNotes', 'Glance Release Notes Documentation', + 'Glance Developers', 'GlanceReleaseNotes', 'One line description of project.', 'Miscellaneous'), ]