fix: keep testcase key order

This commit is contained in:
debugtalk
2020-05-27 21:11:30 +08:00
parent 8b3c4442ae
commit 1de4585dd5

View File

@@ -71,12 +71,23 @@ def ensure_testcase_v3(test_content: Dict) -> Dict:
v3_content = {"config": test_content["config"], "teststeps": []}
for step in test_content["teststeps"]:
teststep = {}
if "api" in step:
teststep["testcase"] = step.pop("api")
teststep = {"name": step.pop("name", "")}
if "variables" in step:
teststep["variables"] = step.pop("variables")
if "request" in step:
teststep["request"] = step.pop("request")
elif "api" in step:
teststep["testcase"] = step.pop("api")
elif "testcase" in step:
teststep["testcase"] = step.pop("testcase")
if "extract" in step:
teststep["extract"] = convert_extractors(step.pop("extract"))
if "validate" in step:
teststep["validate"] = convert_validators(step.pop("validate"))
teststep["extract"] = convert_extractors(step.pop("extract", {}))
teststep["validate"] = convert_validators(step.pop("validate", []))
teststep.update(step)
v3_content["teststeps"].append(teststep)