Pick each epic item's repo by repo-rule.md and record the pick as a label on the issue
CI / tests (pull_request) Failing after 4m10s

This commit is contained in:
2026-11-18 13:26:50 +01:00
parent f444dca67a
commit 29568fab6c
9 changed files with 377 additions and 9 deletions
+13
View File
@@ -59,6 +59,11 @@ class FakeJira:
return {"key": held["key"], "fields": {"parent": held["fields"]["parent"]}} # type: ignore[index]
if method == "POST" and url == ISSUES:
return self.created(body)
if method == "PUT" and (held := next((issue for issue in self.issues if url == f"{ISSUES}/{issue['key']}"), None)):
assert isinstance(body, dict)
added = [change["add"] for change in body["update"]["labels"]]
held["fields"]["labels"] = sorted({*held["fields"]["labels"], *added}) # type: ignore[index]
return None
return Failure(f"Jira answered 404 for {method} {url}")
def page(self, body: object) -> object:
@@ -181,6 +186,14 @@ class Jira(Case):
self.assertEqual(store.file("ABC-78", "Count more.", "", ()), Failure("ABC-78 is neither the epic ABC-12 nor one of its child issues, so nothing can be filed under it"))
self.assertEqual([call for call in self.jira.calls if call[0] == "POST" and call[1] == ISSUES], [])
def test_a_label_jira_refuses_is_not_added(self) -> None:
store = self.new_store()
key = store.file("ABC-12", "Count the runs.", "", ())
self.jira.answers[("PUT", f"{ISSUES}/{key}")] = Failure("Jira answered 403")
self.assertEqual(store.add_label(str(key), "repo:log"), Failure(f"cannot label {key}: Jira answered 403"))
self.jira.answers[("GET", f"{ISSUES}/{key}?fields=parent")] = Failure("Jira answered 500")
self.assertEqual(store.add_label(str(key), "repo:log"), Failure(f"cannot read {key} to label it: Jira answered 500"))
def test_an_epic_the_account_cannot_see_fails_the_read(self) -> None:
store = JiraEpic(Epic(SITE, "ABC-99"), self.env_file, self.jira, to_markdown, to_adf)
self.assertEqual(store.read(), Failure(f"cannot read the epic ABC-99: Jira answered 404 for GET {SITE}/rest/api/3/issue/ABC-99?fields=summary"))