Skip to content

Commit

Permalink
CTOOLS-373: Testing key
Browse files Browse the repository at this point in the history
  • Loading branch information
Matt-Storey-Finbourne committed Oct 1, 2024
1 parent a51369d commit 225089e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions generate/templates/api_test.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,16 @@ class {{#operations}}Test{{classname}}(unittest.IsolatedAsyncioTestCase):
# {{complexType}}
if "example" in jsonContent:
{{paramName}}: {{dataType}} = jsonContent["example"]

if isinstance(jsonContent, object):
is_key = list(jsonContent.keys())[0] if len(jsonContent.keys()) > 0 else None

if is_key is not None:
if list(jsonContent.keys())[0] == 'data-access-page-evaluation':
request_body: Dict[str, EvaluationRequest] = jsonContent["example"]["data-access-page-evaluation"]
else:
request_body: Dict[str, EvaluationRequest] = jsonContent["example"]

elif "examples" in jsonContent:
examples = jsonContent["examples"]
examples = [examples[key] for key in examples]
Expand Down

0 comments on commit 225089e

Please sign in to comment.