adaptavist.get_test_results() can't sort by 'index'
Closed this issue · 1 comments
KanoB commented
Hello,
For some reason our adaptavist plugin in our server JIRA instance does not return index key in the get_test_results endpoint
"{self._adaptavist_api_url}/testrun/{test_run_key}/testresults"
So, when sort is attempted in newer version of adaptavist plugin (> 2.0.0) it fails because index key does not exist
result["scriptResults"] = sorted(result["scriptResults"], key=lambda result: result["index"])
`
def get_test_results(self, test_run_key: str) -> List[Dict[str, Any]]:
"""
Get all test results for a given test run.
:param test_run_key: Test run key of the result to be updated. ex. "JQA-R1234"
:returns: Test results
"""
request_url = f"{self._adaptavist_api_url}/testrun/{test_run_key}/testresults"
self._logger.debug("Getting all test results for run %s", test_run_key)
request = self._get(request_url)
if not request:
return []
results = request.json()
for result in results:
result["scriptResults"] = sorted(result["scriptResults"], key=lambda result: result["index"])
return results
`