Browse Source

Remove six usage

Change-Id: I2fab7d64c808c69ad404064a4b547cdfd945c8a7
changes/09/720409/1 2.0.0
zhurong 10 months ago
parent
commit
2c1a6c2ca0
20 changed files with 60 additions and 81 deletions
  1. +2
    -3
      solum_tempest_plugin/base.py
  2. +2
    -3
      solum_tempest_plugin/tests/application_deployment/camp/test_platform_endpoints.py
  3. +2
    -3
      solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_assemblies.py
  4. +2
    -3
      solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_formats.py
  5. +4
    -5
      solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_parameter_definitions.py
  6. +3
    -4
      solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_plans.py
  7. +2
    -3
      solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_platform.py
  8. +2
    -3
      solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_type_definitions.py
  9. +6
    -7
      solum_tempest_plugin/tests/application_deployment/test_versions.py
  10. +2
    -3
      solum_tempest_plugin/tests/application_deployment/v1/public/test_trigger.py
  11. +2
    -3
      solum_tempest_plugin/tests/application_deployment/v1/test_app.py
  12. +5
    -6
      solum_tempest_plugin/tests/application_deployment/v1/test_assembly.py
  13. +6
    -7
      solum_tempest_plugin/tests/application_deployment/v1/test_component.py
  14. +1
    -2
      solum_tempest_plugin/tests/application_deployment/v1/test_extension.py
  15. +7
    -8
      solum_tempest_plugin/tests/application_deployment/v1/test_language_pack.py
  16. +1
    -2
      solum_tempest_plugin/tests/application_deployment/v1/test_operation.py
  17. +1
    -3
      solum_tempest_plugin/tests/application_deployment/v1/test_plan.py
  18. +2
    -3
      solum_tempest_plugin/tests/application_deployment/v1/test_root.py
  19. +1
    -2
      solum_tempest_plugin/tests/application_deployment/v1/test_sensor.py
  20. +7
    -8
      solum_tempest_plugin/tests/application_deployment/v1/test_service.py

+ 2
- 3
solum_tempest_plugin/base.py View File

@ -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':


+ 2
- 3
solum_tempest_plugin/tests/application_deployment/camp/test_platform_endpoints.py View File

@ -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'])


+ 2
- 3
solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_assemblies.py View File

@ -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'])


+ 2
- 3
solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_formats.py View File

@ -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'])


+ 4
- 5
solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_parameter_definitions.py View File

@ -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'])


+ 3
- 4
solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_plans.py View File

@ -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)


+ 2
- 3
solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_platform.py View File

@ -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'])


+ 2
- 3
solum_tempest_plugin/tests/application_deployment/camp/v1_1/test_type_definitions.py View File

@ -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']:


+ 6
- 7
solum_tempest_plugin/tests/application_deployment/test_versions.py View File

@ -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)


+ 2
- 3
solum_tempest_plugin/tests/application_deployment/v1/public/test_trigger.py View File

@ -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']


+ 2
- 3
solum_tempest_plugin/tests/application_deployment/v1/test_app.py View File

@ -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)


+ 5
- 6
solum_tempest_plugin/tests/application_deployment/v1/test_assembly.py View File

@ -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)


+ 6
- 7
solum_tempest_plugin/tests/application_deployment/v1/test_component.py View File

@ -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)


+ 1
- 2
solum_tempest_plugin/tests/application_deployment/v1/test_extension.py View File

@ -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)


+ 7
- 8
solum_tempest_plugin/tests/application_deployment/v1/test_language_pack.py View File

@ -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)


+ 1
- 2
solum_tempest_plugin/tests/application_deployment/v1/test_operation.py View File

@ -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)


+ 1
- 3
solum_tempest_plugin/tests/application_deployment/v1/test_plan.py View File

@ -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)


+ 2
- 3
solum_tempest_plugin/tests/application_deployment/v1/test_root.py View File

@ -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)


+ 1
- 2
solum_tempest_plugin/tests/application_deployment/v1/test_sensor.py View File

@ -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)


+ 7
- 8
solum_tempest_plugin/tests/application_deployment/v1/test_service.py View File

@ -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, '')


Loading…
Cancel
Save