Skip to content

Commit

Permalink
Correctly parse empty Axe-core JSON report.
Browse files Browse the repository at this point in the history
Fixes #10487.
  • Loading branch information
fniessink committed Dec 11, 2024
1 parent d675f23 commit c064cdd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def __parse_violations(self, violations: dict[str, list[dict[str, list]]], url:
"""Parse the violations."""
entity_attributes = []
for result_type, violations_by_result_type in violations.items():
for violation in violations_by_result_type:
for violation in violations_by_result_type or []:
entity_attributes.extend(self.__parse_violation(violation, result_type, url))
return entity_attributes

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,11 +94,17 @@ async def test_nr_of_issues(self):
self.assert_measurement(response, value="2", entities=self.expected_entities)

async def test_no_issues(self):
"""Test zero issues."""
"""Test zero issues, with an empty violations list."""
self.json["violations"] = []
response = await self.collect(get_request_json_return_value=self.json)
self.assert_measurement(response, value="0", entities=[])

async def test_no_violations_key(self):
"""Test zero issues, without a violations list."""
del self.json["violations"]
response = await self.collect(get_request_json_return_value=self.json)
self.assert_measurement(response, value="0", entities=[])

async def test_filter_by_impact(self):
"""Test that violations can be filtered by impact level."""
self.set_source_parameter("impact", ["serious", "critical"])
Expand Down
1 change: 1 addition & 0 deletions docs/src/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ If your currently installed *Quality-time* version is not the latest version, pl
### Fixed

- When measuring test cases with Visual Studio TRX as source, search all test category items for test case ids, instead of cutting the search short after the first match. Fixes [#10460](https://github.com/ICTU/quality-time/issues/10460).
- Correctly parse empty Axe-core JSON report. Fixes [#10487](https://github.com/ICTU/quality-time/issues/10487).

## v5.20.0 - 2024-12-05

Expand Down

0 comments on commit c064cdd

Please sign in to comment.