def testWithPagingAndSlicing(self): responses = [ mock_api.MockRequest( {'kind': 'numbers', 'items': [1, 2, 3], 'nextPageToken': 'abc'}), mock_api.MockRequest( {'kind': 'numbers', 'items': [4, 5, 6]})] def mockFunc(project=None, maxResults=None, filter=None, pageToken=None): self._page += 1 return responses[self._page - 1] self.assertEqual(utils.All(mockFunc, 'my-project', max_results=5), {'kind': 'numbers', 'items': [1, 2, 3, 4, 5]})
def mockFunc(project=None, maxResults=None, filter=None, pageToken=None): self.assertEqual(project, 'my-project') self.assertEqual(maxResults, 651) self.assertEqual(filter, 'name eq my-instance') self.assertEqual(pageToken, None) return mock_api.MockRequest( {'kind': 'numbers', 'items': [1, 2, 3]})
def mockFunc(project=None, maxResults=None, filter=None, pageToken=None): return mock_api.MockRequest({ 'kind': 'numbers', 'items': [1, 2, 3] })
def mockFunc(project=None, maxResults=None, filter=None, pageToken=None, zone=None): self.assertEqual('some-zone', zone) return mock_api.MockRequest({ 'kind': 'numbers', 'items': [1, 2, 3] })
def mockFunc(project=None, maxResults=None, filter=None, pageToken=None): maxResultValues.append(maxResults) return mock_api.MockRequest({ 'kind': 'numbers', 'items': range(returnedCounts[len(maxResultValues) - 1]), 'nextPageToken': 'next' })
def list(self, **unused_kwargs): return mock_api.MockRequest(zones)