Skip to content

Commit

Permalink
Merge pull request #49 from devolo/fix_get_test_result
Browse files Browse the repository at this point in the history
Fix ValueError in get_test_result
  • Loading branch information
2Fake authored Sep 12, 2023
2 parents bf9f947 + 4f0129a commit a242f19
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.3.3] - 2023/09/12

### Fixed

- get_test_result does not raise in case there are no results

## [2.3.2] - 2023/06/21

### Fixed
Expand Down
10 changes: 4 additions & 6 deletions adaptavist/adaptavist.py
Original file line number Diff line number Diff line change
Expand Up @@ -771,12 +771,10 @@ def get_test_result(self, test_run_key: str, test_case_key: str) -> Dict[str, An
:returns: Test result
"""
response = self.get_test_results(test_run_key)
return (
max(
(item for item in response if item["testCaseKey"] == test_case_key),
key=lambda item: item["id"],
)
or {}
return max(
(item for item in response if item["testCaseKey"] == test_case_key),
key=lambda item: item["id"],
default={},
)

def create_test_result(
Expand Down

0 comments on commit a242f19

Please sign in to comment.