Skip to content

Commit d53906e

Browse files
committed
Fix #833 - Failing test due to querystring order.
1 parent 36dc616 commit d53906e

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

gcloud/storage/test_api.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@
1313
# limitations under the License.
1414

1515
import unittest2
16+
try:
17+
import urlparse
18+
except ImportError:
19+
from urllib.parse import urlparse
1620

1721

1822
class Test_lookup_bucket(unittest2.TestCase):
@@ -144,7 +148,16 @@ def _list_buckets_non_empty_helper(self, project, use_default=False):
144148
self.assertEqual(len(buckets), 1)
145149
self.assertEqual(buckets[0].name, BUCKET_NAME)
146150
self.assertEqual(http._called_with['method'], 'GET')
147-
self.assertEqual(http._called_with['uri'], URI)
151+
152+
# Check that the URL is the same (ignore querystring order).
153+
parsed_uri = urlparse.urlparse(http._called_with['uri'])
154+
EXPECTED_URI = urlparse.urlparse(URI)
155+
self.assertEqual(parsed_uri.scheme, EXPECTED_URI.scheme)
156+
self.assertEqual(parsed_uri.netloc, EXPECTED_URI.netloc)
157+
self.assertEqual(parsed_uri.path, EXPECTED_URI.path)
158+
self.assertEqual(parsed_uri.params, EXPECTED_URI.params)
159+
self.assertEqual(urlparse.parse_qs(parsed_uri.query),
160+
urlparse.parse_qs(EXPECTED_URI.query))
148161

149162
def test_non_empty(self):
150163
self._list_buckets_non_empty_helper('PROJECT', use_default=False)

0 commit comments

Comments
 (0)