Skip to content

Commit 5865d41

Browse files
committed
authproxy: Add support for RPC named arguments
1 parent 406f35d commit 5865d41

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

qa/rpc-tests/test_framework/authproxy.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,16 @@ def _request(self, method, path, postdata):
138138
self.__conn.request(method, path, postdata, headers)
139139
return self._get_response()
140140

141-
def __call__(self, *args):
141+
def __call__(self, *args, **argsn):
142142
AuthServiceProxy.__id_count += 1
143143

144144
log.debug("-%s-> %s %s"%(AuthServiceProxy.__id_count, self._service_name,
145145
json.dumps(args, default=EncodeDecimal, ensure_ascii=self.ensure_ascii)))
146+
if args and argsn:
147+
raise ValueError('Cannot handle both named and positional arguments')
146148
postdata = json.dumps({'version': '1.1',
147149
'method': self._service_name,
148-
'params': args,
150+
'params': args or argsn,
149151
'id': AuthServiceProxy.__id_count}, default=EncodeDecimal, ensure_ascii=self.ensure_ascii)
150152
response = self._request('POST', self.__url.path, postdata.encode('utf-8'))
151153
if response['error'] is not None:

0 commit comments

Comments
 (0)