Merge "Keep py3.X compatibility for urllib.urlencode"
This commit is contained in:
commit
99c1092223
@ -13,7 +13,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import urllib
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from neutron_lbaas.tests.tempest.lib.common import service_client
|
from neutron_lbaas.tests.tempest.lib.common import service_client
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ class DatabaseFlavorsClientJSON(service_client.ServiceClient):
|
|||||||
def list_db_flavors(self, params=None):
|
def list_db_flavors(self, params=None):
|
||||||
url = 'flavors'
|
url = 'flavors'
|
||||||
if params:
|
if params:
|
||||||
url += '?%s' % urllib.urlencode(params)
|
url += '?%s' % parse.urlencode(params)
|
||||||
|
|
||||||
resp, body = self.get(url)
|
resp, body = self.get(url)
|
||||||
self.expected_success(200, resp.status)
|
self.expected_success(200, resp.status)
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import urllib
|
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from neutron_lbaas.tests.tempest.lib.common import service_client
|
from neutron_lbaas.tests.tempest.lib.common import service_client
|
||||||
|
|
||||||
@ -95,7 +96,7 @@ class IdentityV3ClientJSON(service_client.ServiceClient):
|
|||||||
"""Get the list of users."""
|
"""Get the list of users."""
|
||||||
url = 'users'
|
url = 'users'
|
||||||
if params:
|
if params:
|
||||||
url += '?%s' % urllib.urlencode(params)
|
url += '?%s' % parse.urlencode(params)
|
||||||
resp, body = self.get(url)
|
resp, body = self.get(url)
|
||||||
self.expected_success(200, resp.status)
|
self.expected_success(200, resp.status)
|
||||||
body = json.loads(body)
|
body = json.loads(body)
|
||||||
@ -134,7 +135,7 @@ class IdentityV3ClientJSON(service_client.ServiceClient):
|
|||||||
def list_projects(self, params=None):
|
def list_projects(self, params=None):
|
||||||
url = "projects"
|
url = "projects"
|
||||||
if params:
|
if params:
|
||||||
url += '?%s' % urllib.urlencode(params)
|
url += '?%s' % parse.urlencode(params)
|
||||||
resp, body = self.get(url)
|
resp, body = self.get(url)
|
||||||
self.expected_success(200, resp.status)
|
self.expected_success(200, resp.status)
|
||||||
body = json.loads(body)
|
body = json.loads(body)
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import urllib
|
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from neutron_lbaas.tests.tempest.lib.common import service_client
|
from neutron_lbaas.tests.tempest.lib.common import service_client
|
||||||
|
|
||||||
@ -64,7 +65,7 @@ class RegionClientJSON(service_client.ServiceClient):
|
|||||||
"""List regions."""
|
"""List regions."""
|
||||||
url = 'regions'
|
url = 'regions'
|
||||||
if params:
|
if params:
|
||||||
url += '?%s' % urllib.urlencode(params)
|
url += '?%s' % parse.urlencode(params)
|
||||||
resp, body = self.get(url)
|
resp, body = self.get(url)
|
||||||
self.expected_success(200, resp.status)
|
self.expected_success(200, resp.status)
|
||||||
body = json.loads(body)
|
body = json.loads(body)
|
||||||
|
@ -12,8 +12,8 @@
|
|||||||
|
|
||||||
import json
|
import json
|
||||||
import time
|
import time
|
||||||
import urllib
|
|
||||||
|
|
||||||
|
from six.moves.urllib import parse
|
||||||
from tempest_lib.common.utils import misc
|
from tempest_lib.common.utils import misc
|
||||||
from tempest_lib import exceptions as lib_exc
|
from tempest_lib import exceptions as lib_exc
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ class NetworkClientJSON(service_client.ServiceClient):
|
|||||||
def _list(**filters):
|
def _list(**filters):
|
||||||
uri = self.get_uri(plural_name)
|
uri = self.get_uri(plural_name)
|
||||||
if filters:
|
if filters:
|
||||||
uri += '?' + urllib.urlencode(filters, doseq=1)
|
uri += '?' + parse.urlencode(filters, doseq=1)
|
||||||
resp, body = self.get(uri)
|
resp, body = self.get(uri)
|
||||||
result = {plural_name: self.deserialize_list(body)}
|
result = {plural_name: self.deserialize_list(body)}
|
||||||
self.expected_success(200, resp.status)
|
self.expected_success(200, resp.status)
|
||||||
@ -124,7 +124,7 @@ class NetworkClientJSON(service_client.ServiceClient):
|
|||||||
plural = self.pluralize(resource_name)
|
plural = self.pluralize(resource_name)
|
||||||
uri = '%s/%s' % (self.get_uri(plural), resource_id)
|
uri = '%s/%s' % (self.get_uri(plural), resource_id)
|
||||||
if fields:
|
if fields:
|
||||||
uri += '?' + urllib.urlencode(fields, doseq=1)
|
uri += '?' + parse.urlencode(fields, doseq=1)
|
||||||
resp, body = self.get(uri)
|
resp, body = self.get(uri)
|
||||||
body = self.deserialize_single(body)
|
body = self.deserialize_single(body)
|
||||||
self.expected_success(200, resp.status)
|
self.expected_success(200, resp.status)
|
||||||
|
@ -20,13 +20,13 @@ import os
|
|||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import urllib
|
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import fixtures
|
import fixtures
|
||||||
from oslo_log import log as logging
|
from oslo_log import log as logging
|
||||||
from oslo_utils import importutils
|
from oslo_utils import importutils
|
||||||
import six
|
import six
|
||||||
|
from six.moves.urllib import parse
|
||||||
import testscenarios
|
import testscenarios
|
||||||
import testtools
|
import testtools
|
||||||
|
|
||||||
@ -742,7 +742,7 @@ class NegativeAutoTest(BaseTestCase):
|
|||||||
if not json_dict:
|
if not json_dict:
|
||||||
return url, None
|
return url, None
|
||||||
elif method in ["GET", "HEAD", "PUT", "DELETE"]:
|
elif method in ["GET", "HEAD", "PUT", "DELETE"]:
|
||||||
return "%s?%s" % (url, urllib.urlencode(json_dict)), None
|
return "%s?%s" % (url, parse.urlencode(json_dict)), None
|
||||||
else:
|
else:
|
||||||
return url, json.dumps(json_dict)
|
return url, json.dumps(json_dict)
|
||||||
|
|
||||||
|
@ -12,9 +12,8 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import urllib
|
|
||||||
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from neutron_lbaas.tests.tempest.lib.common import service_client
|
from neutron_lbaas.tests.tempest.lib.common import service_client
|
||||||
|
|
||||||
@ -28,7 +27,7 @@ class HealthMonitorsClientJSON(service_client.ServiceClient):
|
|||||||
"""List all health monitors."""
|
"""List all health monitors."""
|
||||||
url = 'v2.0/lbaas/healthmonitors'
|
url = 'v2.0/lbaas/healthmonitors'
|
||||||
if params:
|
if params:
|
||||||
url = "{0}?{1}".format(url, urllib.urlencode(params))
|
url = "{0}?{1}".format(url, parse.urlencode(params))
|
||||||
resp, body = self.get(url)
|
resp, body = self.get(url)
|
||||||
body = jsonutils.loads(body)
|
body = jsonutils.loads(body)
|
||||||
self.expected_success(200, resp.status)
|
self.expected_success(200, resp.status)
|
||||||
@ -38,7 +37,7 @@ class HealthMonitorsClientJSON(service_client.ServiceClient):
|
|||||||
"""Get health monitor details."""
|
"""Get health monitor details."""
|
||||||
url = 'v2.0/lbaas/healthmonitors/{0}'.format(health_monitor_id)
|
url = 'v2.0/lbaas/healthmonitors/{0}'.format(health_monitor_id)
|
||||||
if params:
|
if params:
|
||||||
url = '{0}?{1}'.format(url, urllib.urlencode(params))
|
url = '{0}?{1}'.format(url, parse.urlencode(params))
|
||||||
resp, body = self.get(url)
|
resp, body = self.get(url)
|
||||||
body = jsonutils.loads(body)
|
body = jsonutils.loads(body)
|
||||||
self.expected_success(200, resp.status)
|
self.expected_success(200, resp.status)
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import urllib
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ class ListenersClientJSON(service_client.ServiceClient):
|
|||||||
"""List all listeners."""
|
"""List all listeners."""
|
||||||
url = 'v2.0/lbaas/listeners'
|
url = 'v2.0/lbaas/listeners'
|
||||||
if params:
|
if params:
|
||||||
url = '{0}?{1}'.format(url, urllib.urlencode(params))
|
url = '{0}?{1}'.format(url, parse.urlencode(params))
|
||||||
resp, body = self.get(url)
|
resp, body = self.get(url)
|
||||||
body = jsonutils.loads(body)
|
body = jsonutils.loads(body)
|
||||||
self.expected_success(200, resp.status)
|
self.expected_success(200, resp.status)
|
||||||
@ -38,7 +38,7 @@ class ListenersClientJSON(service_client.ServiceClient):
|
|||||||
"""Get listener details."""
|
"""Get listener details."""
|
||||||
url = 'v2.0/lbaas/listeners/{0}'.format(listener_id)
|
url = 'v2.0/lbaas/listeners/{0}'.format(listener_id)
|
||||||
if params:
|
if params:
|
||||||
url = '{0}?{1}'.format(url, urllib.urlencode(params))
|
url = '{0}?{1}'.format(url, parse.urlencode(params))
|
||||||
resp, body = self.get(url)
|
resp, body = self.get(url)
|
||||||
body = jsonutils.loads(body)
|
body = jsonutils.loads(body)
|
||||||
self.expected_success(200, resp.status)
|
self.expected_success(200, resp.status)
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import urllib
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ class LoadBalancersClientJSON(service_client.ServiceClient):
|
|||||||
"""List all load balancers."""
|
"""List all load balancers."""
|
||||||
url = 'v2.0/lbaas/loadbalancers'
|
url = 'v2.0/lbaas/loadbalancers'
|
||||||
if params:
|
if params:
|
||||||
url = '{0}?{1}'.format(url, urllib.urlencode(params))
|
url = '{0}?{1}'.format(url, parse.urlencode(params))
|
||||||
resp, body = self.get(url)
|
resp, body = self.get(url)
|
||||||
body = jsonutils.loads(body)
|
body = jsonutils.loads(body)
|
||||||
self.expected_success(200, resp.status)
|
self.expected_success(200, resp.status)
|
||||||
@ -38,7 +38,7 @@ class LoadBalancersClientJSON(service_client.ServiceClient):
|
|||||||
"""Get load balancer details."""
|
"""Get load balancer details."""
|
||||||
url = 'v2.0/lbaas/loadbalancers/{0}'.format(load_balancer_id)
|
url = 'v2.0/lbaas/loadbalancers/{0}'.format(load_balancer_id)
|
||||||
if params:
|
if params:
|
||||||
url = '{0}?{1}'.format(url, urllib.urlencode(params))
|
url = '{0}?{1}'.format(url, parse.urlencode(params))
|
||||||
resp, body = self.get(url)
|
resp, body = self.get(url)
|
||||||
body = jsonutils.loads(body)
|
body = jsonutils.loads(body)
|
||||||
self.expected_success(200, resp.status)
|
self.expected_success(200, resp.status)
|
||||||
@ -72,7 +72,7 @@ class LoadBalancersClientJSON(service_client.ServiceClient):
|
|||||||
"""Get a load balancer's status tree."""
|
"""Get a load balancer's status tree."""
|
||||||
url = 'v2.0/lbaas/loadbalancers/{0}/statuses'.format(load_balancer_id)
|
url = 'v2.0/lbaas/loadbalancers/{0}/statuses'.format(load_balancer_id)
|
||||||
if params:
|
if params:
|
||||||
url = '{0}?{1}'.format(url, urllib.urlencode(params))
|
url = '{0}?{1}'.format(url, parse.urlencode(params))
|
||||||
resp, body = self.get(url)
|
resp, body = self.get(url)
|
||||||
body = jsonutils.loads(body)
|
body = jsonutils.loads(body)
|
||||||
self.expected_success(200, resp.status)
|
self.expected_success(200, resp.status)
|
||||||
@ -82,7 +82,7 @@ class LoadBalancersClientJSON(service_client.ServiceClient):
|
|||||||
"""Get a load balancer's stats."""
|
"""Get a load balancer's stats."""
|
||||||
url = 'v2.0/lbaas/loadbalancers/{0}/stats'.format(load_balancer_id)
|
url = 'v2.0/lbaas/loadbalancers/{0}/stats'.format(load_balancer_id)
|
||||||
if params:
|
if params:
|
||||||
url = '{0}?{1}'.format(url, urllib.urlencode(params))
|
url = '{0}?{1}'.format(url, parse.urlencode(params))
|
||||||
resp, body = self.get(url)
|
resp, body = self.get(url)
|
||||||
body = jsonutils.loads(body)
|
body = jsonutils.loads(body)
|
||||||
self.expected_success(200, resp.status)
|
self.expected_success(200, resp.status)
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import urllib
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ class MembersClientJSON(service_client.ServiceClient):
|
|||||||
"""
|
"""
|
||||||
url = 'v2.0/lbaas/pools/{0}/members'.format(pool_id)
|
url = 'v2.0/lbaas/pools/{0}/members'.format(pool_id)
|
||||||
if params:
|
if params:
|
||||||
url = "{0}?{1}".format(url, urllib.urlencode(params))
|
url = "{0}?{1}".format(url, parse.urlencode(params))
|
||||||
resp, body = self.get(url)
|
resp, body = self.get(url)
|
||||||
body = jsonutils.loads(body)
|
body = jsonutils.loads(body)
|
||||||
self.expected_success(200, resp.status)
|
self.expected_success(200, resp.status)
|
||||||
@ -39,7 +39,7 @@ class MembersClientJSON(service_client.ServiceClient):
|
|||||||
def get_member(self, pool_id, member_id, params=None):
|
def get_member(self, pool_id, member_id, params=None):
|
||||||
url = 'v2.0/lbaas/pools/{0}/members/{1}'.format(pool_id, member_id)
|
url = 'v2.0/lbaas/pools/{0}/members/{1}'.format(pool_id, member_id)
|
||||||
if params:
|
if params:
|
||||||
url = '{0}?{1}'.format(url, urllib.urlencode(params))
|
url = '{0}?{1}'.format(url, parse.urlencode(params))
|
||||||
resp, body = self.get(url)
|
resp, body = self.get(url)
|
||||||
body = jsonutils.loads(body)
|
body = jsonutils.loads(body)
|
||||||
self.expected_success(200, resp.status)
|
self.expected_success(200, resp.status)
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import urllib
|
from six.moves.urllib import parse
|
||||||
|
|
||||||
from oslo_serialization import jsonutils
|
from oslo_serialization import jsonutils
|
||||||
|
|
||||||
@ -28,7 +28,7 @@ class PoolsClientJSON(service_client.ServiceClient):
|
|||||||
"""List all pools"""
|
"""List all pools"""
|
||||||
url = 'v2.0/lbaas/pools'
|
url = 'v2.0/lbaas/pools'
|
||||||
if params:
|
if params:
|
||||||
url = '{0}?{1}'.format(url, urllib.urlencode(params))
|
url = '{0}?{1}'.format(url, parse.urlencode(params))
|
||||||
resp, body = self.get(url)
|
resp, body = self.get(url)
|
||||||
body = jsonutils.loads(body)
|
body = jsonutils.loads(body)
|
||||||
self.expected_success(200, resp.status)
|
self.expected_success(200, resp.status)
|
||||||
@ -38,7 +38,7 @@ class PoolsClientJSON(service_client.ServiceClient):
|
|||||||
"""List details of a pool"""
|
"""List details of a pool"""
|
||||||
url = 'v2.0/lbaas/pools/{pool_id}'.format(pool_id=pool_id)
|
url = 'v2.0/lbaas/pools/{pool_id}'.format(pool_id=pool_id)
|
||||||
if params:
|
if params:
|
||||||
url = '{0}?{1}'.format(url, urllib.urlencode(params))
|
url = '{0}?{1}'.format(url, parse.urlencode(params))
|
||||||
resp, body = self.get(url)
|
resp, body = self.get(url)
|
||||||
body = jsonutils.loads(body)
|
body = jsonutils.loads(body)
|
||||||
self.expected_success(200, resp.status)
|
self.expected_success(200, resp.status)
|
||||||
|
Loading…
Reference in New Issue
Block a user