Fix handling of nextPageToken. Reviewed in http://codereview.appspot.com/4932041/
This commit is contained in:
@@ -616,7 +616,8 @@ def createResource(http, baseUrl, model, requestBuilder,
|
|||||||
responseSchema = methodDesc['response']
|
responseSchema = methodDesc['response']
|
||||||
if '$ref' in responseSchema:
|
if '$ref' in responseSchema:
|
||||||
responseSchema = schema[responseSchema['$ref']]
|
responseSchema = schema[responseSchema['$ref']]
|
||||||
hasNextPageToken = 'nextPageToken' in responseSchema['properties']
|
hasNextPageToken = 'nextPageToken' in responseSchema.get('properties',
|
||||||
|
{})
|
||||||
hasPageToken = 'pageToken' in methodDesc.get('parameters', {})
|
hasPageToken = 'pageToken' in methodDesc.get('parameters', {})
|
||||||
if hasNextPageToken and hasPageToken:
|
if hasNextPageToken and hasPageToken:
|
||||||
createNextMethod(Resource, methodName + '_next',
|
createNextMethod(Resource, methodName + '_next',
|
||||||
|
|||||||
@@ -299,6 +299,10 @@ class Next(unittest.TestCase):
|
|||||||
q = parse_qs(parsed[4])
|
q = parse_qs(parsed[4])
|
||||||
self.assertEqual(q['pageToken'][0], '123abc')
|
self.assertEqual(q['pageToken'][0], '123abc')
|
||||||
|
|
||||||
|
def test_next_with_method_with_no_properties(self):
|
||||||
|
self.http = HttpMock(datafile('latitude.json'), {'status': '200'})
|
||||||
|
service = build('latitude', 'v1', self.http)
|
||||||
|
request = service.currentLocation().get()
|
||||||
|
|
||||||
class DeveloperKey(unittest.TestCase):
|
class DeveloperKey(unittest.TestCase):
|
||||||
def test_param(self):
|
def test_param(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user