Kill the two surviving mutants of the link edit
This commit is contained in:
@@ -629,6 +629,11 @@ class Editing(unittest.TestCase):
|
||||
self.assertEqual(self.edit(34, {"Blocked by": "36"}), Written(34))
|
||||
self.assertEqual([(method, url) for method, url, _ in self.writes()], [("POST", LINKS), ("DELETE", f"{LINKS}/{link_id('ABC-34', 'ABC-35')}")])
|
||||
|
||||
def test_an_edit_that_names_no_blocked_by_leaves_the_links_as_they_are(self):
|
||||
self.open[0] = issue("ABC-34", scores=PROPERTY, blocked_by=("ABC-35",))
|
||||
self.edit(34, {"L": "2"})
|
||||
self.assertEqual([method for method, _, _ in self.writes()], ["PUT"])
|
||||
|
||||
def test_a_blocked_by_the_issue_already_holds_writes_nothing(self):
|
||||
self.open[0] = issue("ABC-34", scores=PROPERTY, blocked_by=("ABC-35", "ABC-36"))
|
||||
self.assertEqual(self.edit(34, {"Blocked by": "36, 35"}), Written(34))
|
||||
@@ -741,11 +746,14 @@ class Finishing(unittest.TestCase):
|
||||
self.open = [issue("ABC-34"), issue("ABC-35")]
|
||||
self.transitions: object = {"transitions": [transition("11", "Start", "In Progress", "indeterminate"), transition("31", "Mark as done", "Done")]}
|
||||
self.moved: object = None
|
||||
self.search_refused: Failure | None = None
|
||||
|
||||
def http(self, method: str, url: str, authorization: str, body: object) -> object:
|
||||
"""Stands in for Jira: answers the epic, self.open to the search, self.transitions for ABC-34's transitions and self.moved to a transition of it."""
|
||||
"""Stands in for Jira: answers the epic, self.open to the search, or self.search_refused where set, self.transitions for ABC-34's transitions and self.moved to a transition of it."""
|
||||
self.calls.append((method, url, body))
|
||||
assert authorization == AUTHORIZATION
|
||||
if url == SEARCH and self.search_refused:
|
||||
return self.search_refused
|
||||
if url == TRANSITIONS:
|
||||
return self.transitions if method == "GET" else self.moved
|
||||
return {SEARCH: {"issues": self.open}}.get(url, {"key": "ABC-12"})
|
||||
@@ -760,6 +768,11 @@ class Finishing(unittest.TestCase):
|
||||
self.assertEqual(self.finish(), Written(34))
|
||||
self.assertEqual(self.posts(), [("POST", TRANSITIONS, {"transition": {"id": "31"}})])
|
||||
|
||||
def test_a_search_jira_refuses_fails_the_finish_before_any_move(self):
|
||||
self.search_refused = Failure("HTTP 500")
|
||||
self.assertEqual(self.finish(), Failure("HTTP 500"))
|
||||
self.assertEqual(self.posts(), [])
|
||||
|
||||
def test_a_config_that_names_no_transition_fails_before_any_request(self):
|
||||
self.assertEqual(self.finish(by=None), Failure("the config names no transition to finish an item by: set `jira-finish-transition` and `jira-finish-status`, as `project-config --help` shows"))
|
||||
self.assertEqual(self.calls, [])
|
||||
|
||||
Reference in New Issue
Block a user