Test the scoring call, its answer and the refusals a mutant survived
CI / tests (pull_request) Has been cancelled

This commit is contained in:
Lilleman
2026-11-20 15:45:45 +01:00
parent af81dcdcbc
commit 481e13253a
5 changed files with 113 additions and 0 deletions
+20
View File
@@ -221,6 +221,26 @@ class Jira(Case):
self.jira.answers[("POST", TRANSITIONS)] = Failure("Jira answered 503")
self.assertEqual(self.new_store().close("Shipped."), Failure("posted the summary on ABC-12, but cannot move ABC-12 by 'Mark as done': Jira answered 503; close the epic in Jira rather than posting the summary again"))
def test_scores_a_sub_task_of_a_child_but_no_issue_of_another_epic(self) -> None:
store = self.new_store()
key = store.file("ABC-12", "Count the runs.", "", ())
assert isinstance(key, str), key
task = store.file(key, "Count them in the API.", "", ())
assert isinstance(task, str), task
scores = {"L": 2, "E": 1, "I": 2, "S": 3}
self.assertIsNone(store.set_scores(task, scores, "", "Scored."))
read = f"{ISSUES}/{key}?fields=parent&properties=plan-item"
self.jira.answers[("GET", read)] = {"fields": {"parent": {"key": "XYZ-1"}}}
refused = store.set_scores(key, scores, "", "Scored.")
assert isinstance(refused, Failure), refused
self.assertTrue(refused.reason.startswith("cannot read XYZ-1 to score its sub-task: "), refused.reason)
for answer in ({"fields": {"parent": {"key": task}}}, {"fields": {"parent": {"key": 12}}}, {"fields": {}}, {"fields": "none"}, []):
with self.subTest(answer=answer):
self.jira.answers[("GET", read)] = answer
self.assertEqual(store.set_scores(key, scores, "", "Scored."), Failure(f"{key} is not one of the child issues of the epic ABC-12, so it cannot be scored"))
self.jira.answers[("GET", read)] = {"fields": {"parent": {"key": "ABC-12"}}, "properties": []}
self.assertIsNone(store.set_scores(key, scores, "", "Scored."))
def test_says_how_far_a_scoring_came_where_jira_fails(self) -> None:
store = self.new_store()
key = store.file("ABC-12", "Count the runs.", "", ())