Let do-epic --file take --blocked-by and --parent, so a change a repo ships as two pull requests gets an issue for each
CI / tests (pull_request) Failing after 3m45s
CI / tests (pull_request) Failing after 3m45s
This commit is contained in:
@@ -21,6 +21,7 @@ EPIC_URL = f"{SITE}/rest/api/3/issue/ABC-12?fields=summary"
|
||||
ISSUE_TYPES = f"{SITE}/rest/api/3/issue/createmeta/ABC/issuetypes"
|
||||
SEARCH = f"{SITE}/rest/api/3/search/jql"
|
||||
ISSUES = f"{SITE}/rest/api/3/issue"
|
||||
LINKS = f"{SITE}/rest/api/3/issueLink"
|
||||
RANK = f"{SITE}/rest/agile/1.0/issue/rank"
|
||||
TO_DO = {"name": "To Do", "statusCategory": {"key": "new"}}
|
||||
DONE = {"name": "Done", "statusCategory": {"key": "done"}}
|
||||
@@ -91,6 +92,11 @@ class FakeJira:
|
||||
return self.created(body)
|
||||
if method == "PUT" and url == RANK:
|
||||
return self.ranked(body)
|
||||
if method == "POST" and url == LINKS:
|
||||
assert isinstance(body, dict) and body["type"] == {"name": "Blocks"}, body
|
||||
links = next(issue for issue in self.issues if issue["key"] == body["outwardIssue"]["key"])["fields"]["issuelinks"] # type: ignore[index]
|
||||
links.append({"id": str(len(links) + 1), "type": {"inward": "is blocked by", "outward": "blocks"}, "inwardIssue": body["inwardIssue"]}) # type: ignore[index]
|
||||
return None
|
||||
if method == "POST" and (held := next((issue for issue in self.issues if url == f"{ISSUES}/{issue['key']}/comment"), None)):
|
||||
assert isinstance(body, dict)
|
||||
self.comments.setdefault(str(held["key"]), []).append(body["body"])
|
||||
@@ -304,6 +310,14 @@ class Jira(Case):
|
||||
self.jira.answers[("POST", ISSUES)] = answer
|
||||
self.assertEqual(self.new_store().file("ABC-12", "Count the runs.", "", ()), Failure(f"{reason}; unless Jira refused the request, the issue may exist: look under ABC-12 before filing it again"))
|
||||
|
||||
def test_a_link_jira_refuses_leaves_the_issue_filed_and_names_its_key(self) -> None:
|
||||
store = self.new_store()
|
||||
first = store.file("ABC-12", "Pin the behaviour.", "", ())
|
||||
assert isinstance(first, str)
|
||||
self.jira.answers[("POST", LINKS)] = Failure("Jira answered 403")
|
||||
self.assertEqual(store.file("ABC-12", "Change the behaviour.", "", (), first), Failure(f"filed ABC-101 under ABC-12, but cannot link it as blocked by {first}: Jira answered 403; link it in Jira"))
|
||||
self.assertEqual([issue["key"] for issue in self.jira.issues], [first, "ABC-101"])
|
||||
|
||||
def test_a_detail_the_codec_refuses_leaves_the_epic_as_it_was(self) -> None:
|
||||
store = JiraEpic(EPIC, self.env_file, self.jira, to_markdown, lambda markdown: Failure("adf-codec refused it"))
|
||||
self.assertEqual(store.file("ABC-12", "Count the runs.", "Why.", ()), Failure("cannot convert the detail to a Jira description: adf-codec refused it"))
|
||||
|
||||
Reference in New Issue
Block a user