Keep py3.X compatibility for urllib.urlencode

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

Partial-Bug: #1280105

Change-Id: I2c0447af3206cdfc55ba22748b2793de8eb94cfb
This commit is contained in:
Fengqian Gao 2014-02-14 16:12:10 +08:00
parent d19db8efe6
commit 18027816d3

View File

@ -18,11 +18,10 @@
"""Base classes for API tests. """Base classes for API tests.
""" """
import urllib
import flask import flask
import pecan import pecan
import pecan.testing import pecan.testing
from six.moves import urllib
from ceilometer.api import acl from ceilometer.api import acl
from ceilometer.api.v1 import app as v1_app from ceilometer.api.v1 import app as v1_app
@ -61,7 +60,7 @@ class TestBase(db_test_base.TestBase):
def get(self, path, headers=None, **kwds): def get(self, path, headers=None, **kwds):
if kwds: if kwds:
query = path + '?' + urllib.urlencode(kwds) query = path + '?' + urllib.parse.urlencode(kwds)
else: else:
query = path query = path
rv = self.test_app.get(query, headers=headers) rv = self.test_app.get(query, headers=headers)