From 2c1a6c2ca005948a6851f1b254d21e23d6463269 Mon Sep 17 00:00:00 2001 From: zhurong Date: Thu, 16 Apr 2020 02:28:20 -0700 Subject: [PATCH] Remove six usage Change-Id: I2fab7d64c808c69ad404064a4b547cdfd945c8a7 --- solum_tempest_plugin/base.py | 5 ++--- .../camp/test_platform_endpoints.py | 5 ++--- .../camp/v1_1/test_assemblies.py | 5 ++--- .../camp/v1_1/test_formats.py | 5 ++--- .../camp/v1_1/test_parameter_definitions.py | 9 ++++----- .../camp/v1_1/test_plans.py | 7 +++---- .../camp/v1_1/test_platform.py | 5 ++--- .../camp/v1_1/test_type_definitions.py | 5 ++--- .../tests/application_deployment/test_versions.py | 13 ++++++------- .../v1/public/test_trigger.py | 5 ++--- .../tests/application_deployment/v1/test_app.py | 5 ++--- .../application_deployment/v1/test_assembly.py | 11 +++++------ .../application_deployment/v1/test_component.py | 13 ++++++------- .../application_deployment/v1/test_extension.py | 3 +-- .../v1/test_language_pack.py | 15 +++++++-------- .../application_deployment/v1/test_operation.py | 3 +-- .../tests/application_deployment/v1/test_plan.py | 4 +--- .../tests/application_deployment/v1/test_root.py | 5 ++--- .../application_deployment/v1/test_sensor.py | 3 +-- .../application_deployment/v1/test_service.py | 15 +++++++-------- 20 files changed, 60 insertions(+), 81 deletions(-) diff --git a/solum_tempest_plugin/base.py b/solum_tempest_plugin/base.py index 99ad03a..3e52bb5 100644 --- a/solum_tempest_plugin/base.py +++ b/solum_tempest_plugin/base.py @@ -16,7 +16,6 @@ import copy import json import os import random -import six import string import time @@ -165,7 +164,7 @@ class SolumClient(rest_client.RestClient): def delete_created_lps(self): resp, body = self.get('v1/language_packs') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') data = json.loads(body) [self._delete_language_pack(pl['uuid']) for pl in data] @@ -200,7 +199,7 @@ class SolumClient(rest_client.RestClient): class SolumResponse(object): def __init__(self, resp, body, body_type): self.resp = resp - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') self.body = body if body_type == 'json': diff --git a/solum_tempest_plugin/tests/application_deployment/camp/test_platform_endpoints.py b/solum_tempest_plugin/tests/application_deployment/camp/test_platform_endpoints.py index 3930a06..ddef951 100644 --- a/solum_tempest_plugin/tests/application_deployment/camp/test_platform_endpoints.py +++ b/solum_tempest_plugin/tests/application_deployment/camp/test_platform_endpoints.py @@ -11,7 +11,6 @@ # under the License. import json -import six from solum_tempest_plugin import base @@ -26,7 +25,7 @@ class PlatformDiscoveryTestCase(base.TestCase): request_without_auth('camp/platform_endpoints', 'GET')) self.assertEqual(200, resp.status) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') endpoints = json.loads(body) self.assertEqual('platform_endpoints', endpoints['type']) @@ -47,7 +46,7 @@ class PlatformDiscoveryTestCase(base.TestCase): request_without_auth(rel_ep_url, 'GET')) self.assertEqual(200, resp.status) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') endpoint = json.loads(body) self.assertEqual('platform_endpoint', endpoint['type']) diff --git a/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_assemblies.py b/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_assemblies.py index a99a309..17784b6 100644 --- a/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_assemblies.py +++ b/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_assemblies.py @@ -11,7 +11,6 @@ # under the License. import json -import six from tempest.lib import exceptions as tempest_exceptions import yaml @@ -69,7 +68,7 @@ class TestAssembliesController(base.TestCase): self.assertEqual(200, resp.status, 'GET assemblies resource') # pick out the assemebly link for our new assembly uuid - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') assemblies_dct = json.loads(body) camp_link = None @@ -87,7 +86,7 @@ class TestAssembliesController(base.TestCase): resp, body = self.client.get(url) self.assertEqual(200, resp.status, msg) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') assembly = json.loads(body) self.assertEqual('assembly', assembly['type']) diff --git a/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_formats.py b/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_formats.py index 9095c43..8100ea8 100644 --- a/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_formats.py +++ b/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_formats.py @@ -11,7 +11,6 @@ # under the License. import json -import six from solum_tempest_plugin import base @@ -28,7 +27,7 @@ class TestSupportedFormats(base.TestCase): self.skipTest('CAMP not enabled.') resp, body = self.client.get('camp/v1_1/formats/') self.assertEqual(200, resp.status, 'GET formats resource') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') formats = json.loads(body) self.assertEqual('formats', formats['type']) @@ -46,7 +45,7 @@ class TestSupportedFormats(base.TestCase): # get our lone platform_endpoint resource resp, body = self.client.get(url) self.assertEqual(200, resp.status, 'GET JSON format resource') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') formatr = json.loads(body) self.assertEqual('format', formatr['type']) diff --git a/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_parameter_definitions.py b/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_parameter_definitions.py index bdd995a..a341f8a 100644 --- a/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_parameter_definitions.py +++ b/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_parameter_definitions.py @@ -11,7 +11,6 @@ # under the License. import json -import six from solum_tempest_plugin import base @@ -28,7 +27,7 @@ class TestParameterDefinitions(base.TestCase): self.skipTest('CAMP not enabled.') resp, body = self.client.get('camp/v1_1/assemblies/') self.assertEqual(200, resp.status, 'GET assemblies resource') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') assemblies = json.loads(body) @@ -40,7 +39,7 @@ class TestParameterDefinitions(base.TestCase): resp, body = self.client.get(url) self.assertEqual(200, resp.status, 'GET assembly parameter_definitions resource') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') pd_resc = json.loads(body) self.assertEqual('parameter_definitions', pd_resc['type']) @@ -72,7 +71,7 @@ class TestParameterDefinitions(base.TestCase): self.skipTest('CAMP not enabled.') resp, body = self.client.get('camp/v1_1/plans/') self.assertEqual(200, resp.status, 'GET plans resource') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') plans = json.loads(body) @@ -84,7 +83,7 @@ class TestParameterDefinitions(base.TestCase): resp, body = self.client.get(url) self.assertEqual(200, resp.status, 'GET plans parameter_definitions resource') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') pd_resc = json.loads(body) self.assertEqual('parameter_definitions', pd_resc['type']) diff --git a/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_plans.py b/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_plans.py index 0ebcaba..0b9ad32 100644 --- a/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_plans.py +++ b/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_plans.py @@ -12,7 +12,6 @@ import copy import json -import six from tempest.lib import exceptions as tempest_exceptions import yaml @@ -100,7 +99,7 @@ class TestPlansController(base.TestCase): self.assertEqual(200, resp.status, 'GET plans resource') # pick out the plan link for our new plan uuid - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') plans_dct = json.loads(body) camp_link = None @@ -119,7 +118,7 @@ class TestPlansController(base.TestCase): self.assertEqual(200, resp.status, msg) # CAMP plans are rendered in JSON - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') plan = json.loads(body) self.assertEqual(base.plan_sample_data['name'], plan['name']) @@ -350,7 +349,7 @@ class TestPlansController(base.TestCase): uri, patch_json, headers={'content-type': 'application/json-patch+json'}) self.assertEqual(200, resp.status) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') json_data = json.loads(body) self.assertIn('tags', json_data) diff --git a/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_platform.py b/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_platform.py index 04ad564..4f9be97 100644 --- a/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_platform.py +++ b/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_platform.py @@ -11,7 +11,6 @@ # under the License. import json -import six from solum_tempest_plugin import base @@ -21,7 +20,7 @@ class TestPlatformAndContainers(base.TestCase): def _test_get_resource(self, url, rtype, name): resp, body = self.client.get(url) self.assertEqual(200, resp.status, 'GET %s resource' % rtype) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') resource = json.loads(body) self.assertEqual(rtype, resource['type']) @@ -33,7 +32,7 @@ class TestPlatformAndContainers(base.TestCase): # get and test our platform resource resp, body = self.client.get('camp/v1_1/platform/') self.assertEqual(200, resp.status, 'GET platform resource') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') platform = json.loads(body) self.assertEqual('platform', platform['type']) diff --git a/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_type_definitions.py b/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_type_definitions.py index 5b9274b..901647a 100644 --- a/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_type_definitions.py +++ b/solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_type_definitions.py @@ -11,7 +11,6 @@ # under the License. import json -import six from solum_tempest_plugin import base @@ -22,7 +21,7 @@ class TestTypeDefinitions(base.TestCase): url = abs_url[len(self.client.base_url) + 1:] resp, body = self.client.get(url) self.assertEqual(200, resp.status, msg) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') resource = json.loads(body) self.assertEqual(rtype, resource['type']) @@ -42,7 +41,7 @@ class TestTypeDefinitions(base.TestCase): resp, body = self.client.get('camp/v1_1/type_definitions') self.assertEqual(200, resp.status, 'GET type_definitions resource') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') defs_dct = json.loads(body) for link_dct in defs_dct['type_definition_links']: diff --git a/solum_tempest_plugin/tests/application_deployment/test_versions.py b/solum_tempest_plugin/tests/application_deployment/test_versions.py index 33e4a9c..c766604 100644 --- a/solum_tempest_plugin/tests/application_deployment/test_versions.py +++ b/solum_tempest_plugin/tests/application_deployment/test_versions.py @@ -14,7 +14,6 @@ # under the License. import json -import six from solum_tempest_plugin import base @@ -22,7 +21,7 @@ from solum_tempest_plugin import base class VersionDiscoveryTestCase(base.TestCase): def test_get_root_discovers_v1(self): resp, body = self.client.get('/') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') body = json.loads(body) self.assertEqual(200, resp.status) @@ -35,7 +34,7 @@ class VersionDiscoveryTestCase(base.TestCase): def test_delete_root_discovers_v1(self): resp, body = self.client.delete('/') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') body = json.loads(body) self.assertEqual(200, resp.status) @@ -48,7 +47,7 @@ class VersionDiscoveryTestCase(base.TestCase): def test_post_root_discovers_v1(self): resp, body = self.client.post('/', '{}') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') body = json.loads(body) self.assertEqual(200, resp.status) @@ -61,7 +60,7 @@ class VersionDiscoveryTestCase(base.TestCase): def test_put_root_discovers_v1(self): resp, body = self.client.put('/', '{}') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') body = json.loads(body) self.assertEqual(200, resp.status) @@ -75,7 +74,7 @@ class VersionDiscoveryTestCase(base.TestCase): def test_post_no_body_root_discovers_v1(self): self.skipTest("POST without body will hang request: #1367470") resp, body = self.client.post('/', None) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') body = json.loads(body) self.assertEqual(200, resp.status) @@ -89,7 +88,7 @@ class VersionDiscoveryTestCase(base.TestCase): def test_put_no_body_root_discovers_v1(self): self.skipTest("PUT without body will hang request: #1367470") resp, body = self.client.put('/', None) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') body = json.loads(body) self.assertEqual(200, resp.status) diff --git a/solum_tempest_plugin/tests/application_deployment/v1/public/test_trigger.py b/solum_tempest_plugin/tests/application_deployment/v1/public/test_trigger.py index f1e0086..534b54f 100644 --- a/solum_tempest_plugin/tests/application_deployment/v1/public/test_trigger.py +++ b/solum_tempest_plugin/tests/application_deployment/v1/public/test_trigger.py @@ -11,7 +11,6 @@ # under the License. import json -import six import time import requests @@ -28,7 +27,7 @@ class TestTriggerController(base.TestCase): data = apputils.get_sample_data(languagepack=lp_name) resp = self.client.create_app(data=data) body = resp.body - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') bdy = json.loads(body) trigger_uri = bdy['trigger_uri'] @@ -53,7 +52,7 @@ class TestTriggerController(base.TestCase): data = apputils.get_sample_data(languagepack=lp_name) resp = self.client.create_app(data=data) body = resp.body - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') bdy = json.loads(body) trigger_uri = bdy['trigger_uri'] diff --git a/solum_tempest_plugin/tests/application_deployment/v1/test_app.py b/solum_tempest_plugin/tests/application_deployment/v1/test_app.py index 3f12fff..74d4b49 100644 --- a/solum_tempest_plugin/tests/application_deployment/v1/test_app.py +++ b/solum_tempest_plugin/tests/application_deployment/v1/test_app.py @@ -14,7 +14,6 @@ # under the License. import json -import six import time from tempest.lib import exceptions as tempest_exceptions @@ -99,7 +98,7 @@ class TestAppController(base.TestCase): headers={'content-type': 'application/json'}) self.assertEqual(200, resp.status) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') app_body = json.loads(body) self.assertEqual('newfakeappname', app_body["name"]) @@ -149,7 +148,7 @@ class TestAppController(base.TestCase): self.assertEqual(201, create_resp.status) id = create_resp.id resp, body = self.client.delete_app(id) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') self.assertEqual(202, resp.status) self.assertEqual('', body) diff --git a/solum_tempest_plugin/tests/application_deployment/v1/test_assembly.py b/solum_tempest_plugin/tests/application_deployment/v1/test_assembly.py index 137156a..61c636d 100644 --- a/solum_tempest_plugin/tests/application_deployment/v1/test_assembly.py +++ b/solum_tempest_plugin/tests/application_deployment/v1/test_assembly.py @@ -14,7 +14,6 @@ # under the License. import json -import six from tempest.lib import exceptions as tempest_exceptions @@ -71,7 +70,7 @@ class TestAssemblyController(base.TestCase): self.assertEqual(200, resp.status) # Search for uuids of created assemblies - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') assembly_list = json.loads(body) found_uuid_1 = False @@ -118,7 +117,7 @@ class TestAssemblyController(base.TestCase): plan_uuid) resp, body = self.client.get('v1/assemblies/%s' % uuid) self.assertEqual(200, resp.status) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') json_data = json.loads(body) self._assert_output_expected(json_data, sample_data) @@ -131,7 +130,7 @@ class TestAssemblyController(base.TestCase): resp, body = self.client.get('v1/assemblies/%s' % uuid, headers=use_https) self.assertEqual(200, resp.status) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') json_data = json.loads(body) self._assert_output_expected(json_data, sample_data) @@ -159,7 +158,7 @@ class TestAssemblyController(base.TestCase): updated_json = json.dumps(updated_data) resp, body = self.client.put('v1/assemblies/%s' % uuid, updated_json) self.assertEqual(200, resp.status) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') json_data = json.loads(body) self._assert_output_expected(json_data, updated_data) @@ -213,7 +212,7 @@ class TestAssemblyController(base.TestCase): uuid = assembly_resp.uuid resp, body = self.client.delete_assembly(uuid) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') self.assertEqual(204, resp.status) self.assertEqual('', body) diff --git a/solum_tempest_plugin/tests/application_deployment/v1/test_component.py b/solum_tempest_plugin/tests/application_deployment/v1/test_component.py index 826d321..60b4d42 100644 --- a/solum_tempest_plugin/tests/application_deployment/v1/test_component.py +++ b/solum_tempest_plugin/tests/application_deployment/v1/test_component.py @@ -14,7 +14,6 @@ # under the License. import json -import six from tempest.lib import exceptions as tempest_exceptions @@ -63,7 +62,7 @@ class TestComponentController(base.TestCase): data = json.dumps(sample_data) resp, body = self.client.post('v1/components', data) self.assertEqual(201, resp.status) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') out_data = json.loads(body) uuid = out_data['uuid'] @@ -73,7 +72,7 @@ class TestComponentController(base.TestCase): def test_components_get_all(self): uuid, assembly_uuid, plan_uuid = self._create_component() resp, body = self.client.get('v1/components') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') data = json.loads(body) self.assertEqual(200, resp.status) @@ -96,7 +95,7 @@ class TestComponentController(base.TestCase): sample_json = json.dumps(sample_data) resp, body = self.client.post('v1/components', sample_json) self.assertEqual(201, resp.status) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') json_data = json.loads(body) self._assert_output_expected(json_data, sample_data) @@ -112,7 +111,7 @@ class TestComponentController(base.TestCase): plan_uuid) resp, body = self.client.get('v1/components/%s' % uuid) self.assertEqual(200, resp.status) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') json_data = json.loads(body) self._assert_output_expected(json_data, sample_data) @@ -132,7 +131,7 @@ class TestComponentController(base.TestCase): updated_json = json.dumps(updated_data) resp, body = self.client.put('v1/components/%s' % uuid, updated_json) self.assertEqual(200, resp.status) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') json_data = json.loads(body) self._assert_output_expected(json_data, updated_data) @@ -156,7 +155,7 @@ class TestComponentController(base.TestCase): def test_components_delete(self): uuid, assembly_uuid, plan_uuid = self._create_component() resp, body = self.client.delete('v1/components/%s' % uuid) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') self.assertEqual(204, resp.status) self.assertEqual('', body) diff --git a/solum_tempest_plugin/tests/application_deployment/v1/test_extension.py b/solum_tempest_plugin/tests/application_deployment/v1/test_extension.py index 24625f1..50f3f46 100644 --- a/solum_tempest_plugin/tests/application_deployment/v1/test_extension.py +++ b/solum_tempest_plugin/tests/application_deployment/v1/test_extension.py @@ -14,7 +14,6 @@ # under the License. import json -import six from solum_tempest_plugin import base @@ -23,7 +22,7 @@ class TestExtensionController(base.TestCase): def test_extensions_get_all(self): resp, body = self.client.get('v1/extensions') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') data = json.loads(body) self.assertEqual(200, resp.status) diff --git a/solum_tempest_plugin/tests/application_deployment/v1/test_language_pack.py b/solum_tempest_plugin/tests/application_deployment/v1/test_language_pack.py index bbcffde..b55b5e2 100644 --- a/solum_tempest_plugin/tests/application_deployment/v1/test_language_pack.py +++ b/solum_tempest_plugin/tests/application_deployment/v1/test_language_pack.py @@ -14,7 +14,6 @@ import json import random -import six import string import time @@ -46,7 +45,7 @@ class TestLanguagePackController(base.TestCase): def _delete_all(self): resp, body = self.client.get('v1/language_packs') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') data = json.loads(body) self.assertEqual(200, resp.status) @@ -61,7 +60,7 @@ class TestLanguagePackController(base.TestCase): jsondata = json.dumps(sample_lp) resp, body = self.client.post('v1/language_packs', jsondata) self.assertEqual(201, resp.status) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') out_data = json.loads(body) uuid = out_data['uuid'] @@ -71,7 +70,7 @@ class TestLanguagePackController(base.TestCase): def test_language_packs_get_all(self): uuid, sample_lp = self._create_language_pack() resp, body = self.client.get('v1/language_packs') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') data = json.loads(body) self.assertEqual(200, resp.status) @@ -84,7 +83,7 @@ class TestLanguagePackController(base.TestCase): sample_json = json.dumps(sample_lp) resp, body = self.client.post('v1/language_packs', sample_json) self.assertEqual(201, resp.status) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') json_data = json.loads(body) self.assertEqual("QUEUED", json_data["status"]) @@ -99,7 +98,7 @@ class TestLanguagePackController(base.TestCase): uuid, sample_lp = self._create_language_pack() resp, body = self.client.get('v1/language_packs/%s' % uuid) self.assertEqual(200, resp.status) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') json_data = json.loads(body) self.assertEqual(sample_lp['source_uri'], json_data['source_uri']) @@ -113,7 +112,7 @@ class TestLanguagePackController(base.TestCase): def test_language_packs_delete(self): uuid, sample_lp = self._create_language_pack() resp, body = self.client.delete('v1/language_packs/%s' % uuid) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') self.assertEqual(204, resp.status) self.assertEqual('', body) @@ -149,7 +148,7 @@ class TestLanguagePackController(base.TestCase): self.assertRaises(tempest_exceptions.Conflict, self.client.delete, 'v1/language_packs/%s' % uuid) body = resp.body - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') bdy = json.loads(body) diff --git a/solum_tempest_plugin/tests/application_deployment/v1/test_operation.py b/solum_tempest_plugin/tests/application_deployment/v1/test_operation.py index bf62a66..383f234 100644 --- a/solum_tempest_plugin/tests/application_deployment/v1/test_operation.py +++ b/solum_tempest_plugin/tests/application_deployment/v1/test_operation.py @@ -14,7 +14,6 @@ # under the License. import json -import six from solum_tempest_plugin import base @@ -23,7 +22,7 @@ class TestOperationController(base.TestCase): def test_operations_get_all(self): resp, body = self.client.get('v1/operations') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') data = json.loads(body) self.assertEqual(200, resp.status) diff --git a/solum_tempest_plugin/tests/application_deployment/v1/test_plan.py b/solum_tempest_plugin/tests/application_deployment/v1/test_plan.py index 2a97205..7a4de15 100644 --- a/solum_tempest_plugin/tests/application_deployment/v1/test_plan.py +++ b/solum_tempest_plugin/tests/application_deployment/v1/test_plan.py @@ -13,8 +13,6 @@ # License for the specific language governing permissions and limitations # under the License. -import six - from tempest.lib import exceptions as tempest_exceptions import yaml @@ -226,7 +224,7 @@ class TestPlanController(base.TestCase): self.assertEqual(201, create_resp.status) uuid = create_resp.uuid resp, body = self.client.delete_plan(uuid) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') self.assertEqual(202, resp.status) self.assertEqual('', body) diff --git a/solum_tempest_plugin/tests/application_deployment/v1/test_root.py b/solum_tempest_plugin/tests/application_deployment/v1/test_root.py index 932e283..d52e351 100644 --- a/solum_tempest_plugin/tests/application_deployment/v1/test_root.py +++ b/solum_tempest_plugin/tests/application_deployment/v1/test_root.py @@ -14,7 +14,6 @@ # under the License. import json -import six from solum_tempest_plugin import base @@ -24,7 +23,7 @@ class TestRootController(base.TestCase): def test_index(self): resp, body = self.client.request_without_auth('', 'GET') self.assertEqual(200, resp.status) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') data = json.loads(body) self.assertEqual(data[0]['id'], 'v1.0') @@ -36,7 +35,7 @@ class TestRootController(base.TestCase): def test_platform(self): resp, body = self.client.request_without_auth('v1', 'GET') self.assertEqual(200, resp.status) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') data = json.loads(body) self.assertEqual(data['uri'], '%s/v1' % self.client.base_url) diff --git a/solum_tempest_plugin/tests/application_deployment/v1/test_sensor.py b/solum_tempest_plugin/tests/application_deployment/v1/test_sensor.py index 44a950c..4160d5b 100644 --- a/solum_tempest_plugin/tests/application_deployment/v1/test_sensor.py +++ b/solum_tempest_plugin/tests/application_deployment/v1/test_sensor.py @@ -14,7 +14,6 @@ # under the License. import json -import six from solum_tempest_plugin import base @@ -23,7 +22,7 @@ class TestSensorController(base.TestCase): def test_sensors_get_all(self): resp, body = self.client.get('v1/sensors') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') data = json.loads(body) self.assertEqual(200, resp.status) diff --git a/solum_tempest_plugin/tests/application_deployment/v1/test_service.py b/solum_tempest_plugin/tests/application_deployment/v1/test_service.py index 80e6382..af7312a 100644 --- a/solum_tempest_plugin/tests/application_deployment/v1/test_service.py +++ b/solum_tempest_plugin/tests/application_deployment/v1/test_service.py @@ -14,7 +14,6 @@ # under the License. import json -import six from tempest.lib import exceptions as tempest_exceptions @@ -36,7 +35,7 @@ class TestServiceController(base.TestCase): def _delete_all(self): resp, body = self.client.get('v1/services') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') data = json.loads(body) self.assertEqual(resp.status, 200) @@ -58,7 +57,7 @@ class TestServiceController(base.TestCase): jsondata = json.dumps(sample_data) resp, body = self.client.post('v1/services', jsondata) self.assertEqual(resp.status, 201) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') out_data = json.loads(body) uuid = out_data['uuid'] @@ -68,7 +67,7 @@ class TestServiceController(base.TestCase): def test_services_get_all(self): uuid = self._create_service() resp, body = self.client.get('v1/services') - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') data = json.loads(body) self.assertEqual(resp.status, 200) @@ -79,7 +78,7 @@ class TestServiceController(base.TestCase): sample_json = json.dumps(sample_data) resp, body = self.client.post('v1/services', sample_json) self.assertEqual(resp.status, 201) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') json_data = json.loads(body) self._assert_output_expected(json_data, sample_data) @@ -93,7 +92,7 @@ class TestServiceController(base.TestCase): uuid = self._create_service() resp, body = self.client.get('v1/services/%s' % uuid) self.assertEqual(resp.status, 200) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') json_data = json.loads(body) self._assert_output_expected(json_data, sample_data) @@ -113,7 +112,7 @@ class TestServiceController(base.TestCase): updated_json = json.dumps(updated_data) resp, body = self.client.put('v1/services/%s' % uuid, updated_json) self.assertEqual(resp.status, 200) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') json_data = json.loads(body) self._assert_output_expected(json_data, updated_data) @@ -137,7 +136,7 @@ class TestServiceController(base.TestCase): def test_services_delete(self): uuid = self._create_service() resp, body = self.client.delete('v1/services/%s' % uuid) - if isinstance(body, six.binary_type): + if isinstance(body, bytes): body = body.decode('utf-8') self.assertEqual(resp.status, 204) self.assertEqual(body, '')