Remove six library

Change-Id: Iadf31a4d5861cf1e821c6b4473ccec23899a2338
This commit is contained in:
Vishakha Agarwal 2020-03-23 21:06:29 +05:30
parent 47244edbc5
commit 9c8933c6bb
5 changed files with 19 additions and 23 deletions

View File

@ -14,8 +14,7 @@
import json
import six
from six.moves import http_client
import http.client
from tempest import config
from tempest.lib.common import rest_client
@ -53,26 +52,26 @@ class Federation(Identity):
def _delete(self, entity_id, **kwargs):
url = self._build_path(entity_id)
resp, body = super(Federation, self).delete(url, **kwargs)
self.expected_success(http_client.NO_CONTENT, resp.status)
self.expected_success(http.client.NO_CONTENT, resp.status)
return rest_client.ResponseBody(resp, body)
def _get(self, entity_id=None, **kwargs):
url = self._build_path(entity_id)
resp, body = super(Federation, self).get(url, **kwargs)
self.expected_success(http_client.OK, resp.status)
body = json.loads(body if six.PY2 else body.decode('utf-8'))
self.expected_success(http.client.OK, resp.status)
body = json.loads(body.decode('utf-8'))
return rest_client.ResponseBody(resp, body)
def _patch(self, entity_id, body, **kwargs):
url = self._build_path(entity_id)
resp, body = super(Federation, self).patch(url, body, **kwargs)
self.expected_success(http_client.OK, resp.status)
body = json.loads(body if six.PY2 else body.decode('utf-8'))
self.expected_success(http.client.OK, resp.status)
body = json.loads(body.decode('utf-8'))
return rest_client.ResponseBody(resp, body)
def _put(self, entity_id, body, **kwargs):
url = self._build_path(entity_id)
resp, body = super(Federation, self).put(url, body, **kwargs)
self.expected_success(http_client.CREATED, resp.status)
body = json.loads(body if six.PY2 else body.decode('utf-8'))
self.expected_success(http.client.CREATED, resp.status)
body = json.loads(body.decode('utf-8'))
return rest_client.ResponseBody(resp, body)

View File

@ -14,7 +14,6 @@
import json
import six
from tempest.lib.common import rest_client
from keystone_tempest_plugin.services.identity import clients
@ -26,7 +25,7 @@ class AuthClient(clients.Identity):
resp, body = self.raw_request(
url, 'GET', headers={'X-Auth-Token': token_id})
self.expected_success(200, resp.status)
body = json.loads(body if six.PY2 else body.decode('utf-8'))
body = json.loads(body.decode('utf-8'))
return rest_client.ResponseBody(resp, body)
def get_available_projects_scopes(self, keystone_v3_endpoint, token_id):

View File

@ -14,7 +14,6 @@
import json
import six
from tempest.lib.common import rest_client
from keystone_tempest_plugin.services.identity import clients
@ -63,7 +62,7 @@ class IdentityProvidersClient(clients.Federation):
self._build_path(entity_id=idp_id), 'protocols', protocol_id)
resp, body = self.put(url, put_body)
self.expected_success(201, resp.status)
body = json.loads(body if six.PY2 else body.decode('utf-8'))
body = json.loads(body.decode('utf-8'))
return rest_client.ResponseBody(resp, body)
def delete_protocol_and_mapping(self, idp_id, protocol_id):
@ -80,7 +79,7 @@ class IdentityProvidersClient(clients.Federation):
self._build_path(entity_id=idp_id), 'protocols', protocol_id)
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body if six.PY2 else body.decode('utf-8'))
body = json.loads(body.decode('utf-8'))
return rest_client.ResponseBody(resp, body)
def list_protocols_and_mappings(self, idp_id):
@ -88,7 +87,7 @@ class IdentityProvidersClient(clients.Federation):
url = '%s/%s' % (self._build_path(entity_id=idp_id), 'protocols')
resp, body = self.get(url)
self.expected_success(200, resp.status)
body = json.loads(body if six.PY2 else body.decode('utf-8'))
body = json.loads(body.decode('utf-8'))
return rest_client.ResponseBody(resp, body)
def update_protocol_mapping(self, idp_id, protocol_id, mapping_id):
@ -98,5 +97,5 @@ class IdentityProvidersClient(clients.Federation):
self._build_path(entity_id=idp_id), 'protocols', protocol_id)
resp, body = self.patch(url, patch_body)
self.expected_success(200, resp.status)
body = json.loads(body if six.PY2 else body.decode('utf-8'))
body = json.loads(body.decode('utf-8'))
return rest_client.ResponseBody(resp, body)

View File

@ -12,13 +12,13 @@
# License for the specific language governing permissions and limitations
# under the License.
import http.client
import json
from lxml import etree
from six.moves import http_client
from six.moves import urllib
from tempest import config
from tempest.lib.common.utils import data_utils
import testtools
import urllib
from keystone_tempest_plugin.tests import base
@ -126,7 +126,7 @@ class TestSaml2EcpFederatedAuthentication(base.BaseIdentityTest):
def _get_sp_authn_request(self):
resp = self.saml2_client.send_service_provider_request(
self.keystone_v3_endpoint, self.idp_id, self.protocol_id)
self.assertEqual(http_client.OK, resp.status_code)
self.assertEqual(http.client.OK, resp.status_code)
saml2_authn_request = etree.XML(resp.content)
relay_state = self._str_from_xml(
@ -137,7 +137,7 @@ class TestSaml2EcpFederatedAuthentication(base.BaseIdentityTest):
# Perform the authn request to the identity provider
resp = self.saml2_client.send_identity_provider_authn_request(
saml2_authn_request, self.idp_url, self.username, self.password)
self.assertEqual(http_client.OK, resp.status_code)
self.assertEqual(http.client.OK, resp.status_code)
saml2_idp_authn_response = etree.XML(resp.content)
idp_consumer_url = self._str_from_xml(
@ -161,7 +161,7 @@ class TestSaml2EcpFederatedAuthentication(base.BaseIdentityTest):
# Must receive a redirect from service provider to the URL where the
# unscoped token can be retrieved.
self.assertIn(resp.status_code,
[http_client.FOUND, http_client.SEE_OTHER])
[http.client.FOUND, http.client.SEE_OTHER])
# If this is K2K, don't follow HTTP specs - after the HTTP 302/303
# response don't repeat the call directed to the Location URL. In this
@ -177,7 +177,7 @@ class TestSaml2EcpFederatedAuthentication(base.BaseIdentityTest):
resp = (
self.saml2_client.send_service_provider_unscoped_token_request(
sp_url))
self.assertEqual(http_client.CREATED, resp.status_code)
self.assertEqual(http.client.CREATED, resp.status_code)
self.assertIn('X-Subject-Token', resp.headers)
self.assertNotEmpty(resp.json())

View File

@ -9,5 +9,4 @@ lxml!=3.7.0,>=3.4.1 # BSD
tempest>=17.1.0 # Apache-2.0
oslo.config>=5.2.0 # Apache-2.0
testtools>=2.2.0 # MIT
six>=1.10.0 # MIT
requests>=2.14.2 # Apache-2.0