diff --git a/generate/templates/api_test.mustache b/generate/templates/api_test.mustache index 05271ff..81384bc 100644 --- a/generate/templates/api_test.mustache +++ b/generate/templates/api_test.mustache @@ -87,7 +87,6 @@ class {{#operations}}Test{{classname}}(unittest.IsolatedAsyncioTestCase): {{^isPrimitiveType}} {{#content}} spec_filepath = os.environ['OPENAPI_SPEC_PATH'] - print('spec_filepath', spec_filepath) with open(spec_filepath) as file: openapiSpecJson = file.read() @@ -95,7 +94,6 @@ class {{#operations}}Test{{classname}}(unittest.IsolatedAsyncioTestCase): jsonContent = json.loads(openapiSpecJson) jsonContent = jsonContent["paths"]["{{path}}"][method]["requestBody"]["content"]["application/json"] {{paramName}}: {{{dataType}}} = None - # {{complexType}} if "example" in jsonContent: {{paramName}}: {{dataType}} = jsonContent["example"] elif "examples" in jsonContent: @@ -113,7 +111,9 @@ class {{#operations}}Test{{classname}}(unittest.IsolatedAsyncioTestCase): else: break {{paramName}} = tmp_{{paramName}} - + else: + if '{{dataType}}' == '{{complexType}}': + {{paramName}}: {{dataType}} = {{complexType}}.from_dict({{paramName}}) {{/content}} {{^content}} {{#isArray}} @@ -124,7 +124,6 @@ class {{#operations}}Test{{classname}}(unittest.IsolatedAsyncioTestCase): {{/isPrimitiveType}} {{/vendorExtensions.x-regex}} {{/allParams}} - print() {{#returnType}}response = {{/returnType}}await self.api.{{operationId}}({{#allParams}}{{paramName}}{{^-last}}, {{/-last}}{{/allParams}}) {{#returnType}} assert(response is not None)