[python-nextgen] Fix binary response (#15076)

* fix binary response in python nextgen client

* update samples
This commit is contained in:
William Cheng
2023-03-31 16:16:58 +08:00
committed by GitHub
parent 05fa5601dd
commit b59d535176
36 changed files with 906 additions and 75 deletions

View File

@@ -14,6 +14,7 @@ from __future__ import absolute_import
import unittest
import datetime
import base64
import openapi_client
from openapi_client.api.query_api import QueryApi # noqa: E501
@@ -51,6 +52,13 @@ class TestManual(unittest.TestCase):
e = EchoServerResponseParser(api_response)
self.assertEqual(e.path, "/query/datetime/date/string?datetime_query=2013-10-20T19%3A20%3A30.000000-0500&date_query=2013-10-20&string_query=string_query_example")
def testBinaryGif(self):
api_instance = openapi_client.BodyApi()
# Test binary response
api_response = api_instance.test_binary_gif()
self.assertEqual((base64.b64encode(api_response)).decode("utf-8"), "R0lGODlhAQABAIABAP///wAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==")
class EchoServerResponseParser():
def __init__(self, http_response):
if http_response is None: