Skip to content

Commit

Permalink
Merge pull request #834 from jgeewax/url-param-order
Browse files Browse the repository at this point in the history
Fix #833 - Failing test due to querystring order.
  • Loading branch information
jgeewax committed Apr 16, 2015
2 parents 36dc616 + 37f22dc commit 40d84e9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions gcloud/storage/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,21 @@ def test_empty(self):
self.assertEqual(parse_qs(uri_parts.query), EXPECTED_QUERY)

def _list_buckets_non_empty_helper(self, project, use_default=False):
from six.moves.urllib.parse import parse_qs
from six.moves.urllib.parse import urlencode
from six.moves.urllib.parse import urlparse
from gcloud._testing import _monkey_defaults as _base_monkey_defaults
from gcloud.storage._testing import _monkey_defaults
from gcloud.storage.connection import Connection
BUCKET_NAME = 'bucket-name'
conn = Connection()
query_params = urlencode({'project': project, 'projection': 'noAcl'})
URI = '/'.join([
BASE_URI = '/'.join([
conn.API_BASE_URL,
'storage',
conn.API_VERSION,
'b?%s' % (query_params,),
])
URI = '/'.join([BASE_URI, 'b?%s' % (query_params,)])
http = conn._http = Http(
{'status': '200', 'content-type': 'application/json'},
'{{"items": [{{"name": "{0}"}}]}}'.format(BUCKET_NAME)
Expand All @@ -144,7 +146,9 @@ 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)
self.assertTrue(http._called_with['uri'].startswith(BASE_URI))
self.assertEqual(parse_qs(urlparse(http._called_with['uri']).query),
parse_qs(urlparse(URI).query))

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

0 comments on commit 40d84e9

Please sign in to comment.