From fac1dd9dffba1033245c283bc0468e801c14e910 Mon Sep 17 00:00:00 2001 From: MarcoFalke <*~=`'#}+{/-|&$^_@721217.xyz> Date: Tue, 25 Feb 2025 22:41:41 +0100 Subject: [PATCH] test: Fix authproxy named args debug logging --- test/functional/test_framework/authproxy.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/functional/test_framework/authproxy.py b/test/functional/test_framework/authproxy.py index 37fd5ae5684..e24e5f7312a 100644 --- a/test/functional/test_framework/authproxy.py +++ b/test/functional/test_framework/authproxy.py @@ -105,14 +105,19 @@ class AuthServiceProxy(): self.__conn.request(method, path, postdata, headers) return self._get_response() + def _json_dumps(self, obj): + return json.dumps(obj, default=serialization_fallback, ensure_ascii=self.ensure_ascii) + def get_request(self, *args, **argsn): AuthServiceProxy.__id_count += 1 - log.debug("-{}-> {} {}".format( + log.debug("-{}-> {} {} {}".format( AuthServiceProxy.__id_count, self._service_name, - json.dumps(args or argsn, default=serialization_fallback, ensure_ascii=self.ensure_ascii), + self._json_dumps(args), + self._json_dumps(argsn), )) + if args and argsn: params = dict(args=args, **argsn) else: @@ -123,7 +128,7 @@ class AuthServiceProxy(): 'id': AuthServiceProxy.__id_count} def __call__(self, *args, **argsn): - postdata = json.dumps(self.get_request(*args, **argsn), default=serialization_fallback, ensure_ascii=self.ensure_ascii) + postdata = self._json_dumps(self.get_request(*args, **argsn)) response, status = self._request('POST', self.__url.path, postdata.encode('utf-8')) # For backwards compatibility tests, accept JSON RPC 1.1 responses if 'jsonrpc' not in response: @@ -150,7 +155,7 @@ class AuthServiceProxy(): return response['result'] def batch(self, rpc_call_list): - postdata = json.dumps(list(rpc_call_list), default=serialization_fallback, ensure_ascii=self.ensure_ascii) + postdata = self._json_dumps(list(rpc_call_list)) log.debug("--> " + postdata) response, status = self._request('POST', self.__url.path, postdata.encode('utf-8')) if status != HTTPStatus.OK: @@ -197,7 +202,7 @@ class AuthServiceProxy(): response = json.loads(responsedata, parse_float=decimal.Decimal) elapsed = time.time() - req_start_time if "error" in response and response["error"] is None: - log.debug("<-%s- [%.6f] %s" % (response["id"], elapsed, json.dumps(response["result"], default=serialization_fallback, ensure_ascii=self.ensure_ascii))) + log.debug("<-%s- [%.6f] %s" % (response["id"], elapsed, self._json_dumps(response["result"]))) else: log.debug("<-- [%.6f] %s" % (elapsed, responsedata)) return response, http_response.status