Browse Source

Keep py3.X compatibility for urllib.urlencode

For py3.X, urllib has no attr urlencode while python 2 has.
Change urlencode to keep compatibility.

Change-Id: I9fc041d6fd8b65d0a19f38ae1915dcb2a1b42553
Partial-Bug: #1280105
tags/10.0.0
Harshada Mangesh Kakad 4 years ago
parent
commit
71f6b97480
2 changed files with 4 additions and 4 deletions
  1. +2
    -2
      tempest/services/database/json/flavors_client.py
  2. +2
    -2
      tempest/test.py

+ 2
- 2
tempest/services/database/json/flavors_client.py View File

@@ -14,7 +14,7 @@
# under the License.

from oslo_serialization import jsonutils as json
import urllib
from six.moves import urllib

from tempest.common import service_client

@@ -24,7 +24,7 @@ class DatabaseFlavorsClient(service_client.ServiceClient):
def list_db_flavors(self, params=None):
url = 'flavors'
if params:
url += '?%s' % urllib.urlencode(params)
url += '?%s' % urllib.parse.urlencode(params)

resp, body = self.get(url)
self.expected_success(200, resp.status)

+ 2
- 2
tempest/test.py View File

@@ -19,7 +19,6 @@ import os
import re
import sys
import time
import urllib
import uuid

import fixtures
@@ -27,6 +26,7 @@ from oslo_log import log as logging
from oslo_serialization import jsonutils as json
from oslo_utils import importutils
import six
from six.moves import urllib
from tempest_lib import decorators
import testscenarios
import testtools
@@ -770,7 +770,7 @@ class NegativeAutoTest(BaseTestCase):
if not json_dict:
return url, None
elif method in ["GET", "HEAD", "PUT", "DELETE"]:
return "%s?%s" % (url, urllib.urlencode(json_dict)), None
return "%s?%s" % (url, urllib.parse.urlencode(json_dict)), None
else:
return url, json.dumps(json_dict)


Loading…
Cancel
Save