Add passthrough for query parameters that the stack uses but that don't appear in discovery.
This commit is contained in:
@@ -44,6 +44,7 @@ VARNAME = re.compile('[a-zA-Z0-9_-]+')
|
||||
DISCOVERY_URI = ('https://www.googleapis.com/discovery/v0.3/describe/'
|
||||
'{api}/{apiVersion}')
|
||||
DEFAULT_METHOD_DOC = 'A description of how to use this function'
|
||||
STACK_QUERY_PARAMETERS = ['trace']
|
||||
|
||||
|
||||
def key2param(key):
|
||||
@@ -259,7 +260,7 @@ def createResource(http, baseUrl, model, requestBuilder,
|
||||
|
||||
def method(self, **kwargs):
|
||||
for name in kwargs.iterkeys():
|
||||
if name not in argmap:
|
||||
if name not in argmap and name not in STACK_QUERY_PARAMETERS:
|
||||
raise TypeError('Got an unexpected keyword argument "%s"' % name)
|
||||
|
||||
for name in required_params:
|
||||
|
||||
@@ -103,6 +103,11 @@ class Discovery(unittest.TestCase):
|
||||
request = zoo.query(q="foo", i="1", n="1", b="", a=[1,2,3], o={'a':1}, e='bar')
|
||||
self._check_query_types(request)
|
||||
|
||||
def test_optional_stack_query_parameters(self):
|
||||
self.http = HttpMock(datafile('zoo.json'), {'status': '200'})
|
||||
zoo = build('zoo', 'v1', self.http)
|
||||
request = zoo.query(trace='html')
|
||||
|
||||
def test_buzz_resources(self):
|
||||
self.http = HttpMock(datafile('buzz.json'), {'status': '200'})
|
||||
buzz = build('buzz', 'v1', self.http)
|
||||
|
||||
Reference in New Issue
Block a user