Skip to content

Commit

Permalink
Fix #833 - Failing test due to querystring order.
Browse files Browse the repository at this point in the history
  • Loading branch information
jgeewax committed Apr 16, 2015
1 parent 36dc616 commit d53906e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion gcloud/storage/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
# limitations under the License.

import unittest2
try:
import urlparse
except ImportError:
from urllib.parse import urlparse


class Test_lookup_bucket(unittest2.TestCase):
Expand Down Expand Up @@ -144,7 +148,16 @@ def _list_buckets_non_empty_helper(self, project, use_default=False):
self.assertEqual(len(buckets), 1)
self.assertEqual(buckets[0].name, BUCKET_NAME)
self.assertEqual(http._called_with['method'], 'GET')
self.assertEqual(http._called_with['uri'], URI)

# Check that the URL is the same (ignore querystring order).
parsed_uri = urlparse.urlparse(http._called_with['uri'])
EXPECTED_URI = urlparse.urlparse(URI)
self.assertEqual(parsed_uri.scheme, EXPECTED_URI.scheme)
self.assertEqual(parsed_uri.netloc, EXPECTED_URI.netloc)
self.assertEqual(parsed_uri.path, EXPECTED_URI.path)
self.assertEqual(parsed_uri.params, EXPECTED_URI.params)
self.assertEqual(urlparse.parse_qs(parsed_uri.query),
urlparse.parse_qs(EXPECTED_URI.query))

def test_non_empty(self):
self._list_buckets_non_empty_helper('PROJECT', use_default=False)
Expand Down

0 comments on commit d53906e

Please sign in to comment.