Test the fake's rank refusals and a refused rank after the last issue
CI / tests (pull_request) Successful in 3m9s

This commit is contained in:
2026-11-18 19:37:47 +01:00
parent b1e46d64fa
commit 7bd192735a
2 changed files with 14 additions and 2 deletions
+9 -2
View File
@@ -35,9 +35,16 @@ class MemoryEpicContract(EpicStoreContract, unittest.TestCase):
class Failing(unittest.TestCase):
def test_every_read_and_filing_fails_with_the_reason_given(self) -> None:
def test_every_read_filing_and_rank_fails_with_the_reason_given(self) -> None:
store = MemoryEpic("ABC-12", fails="Jira is down")
self.assertEqual((store.read(), store.file("ABC-12", "Count the runs.", "", ())), (Failure("Jira is down"), Failure("Jira is down")))
self.assertEqual((store.read(), store.file("ABC-12", "Count the runs.", "", ()), store.rank("ABC-100", "ABC-101")), (Failure("Jira is down"),) * 3)
class Ranking(unittest.TestCase):
def test_refuses_to_rank_beside_an_issue_that_isnt_a_child_of_the_epic(self) -> None:
store = MemoryEpic("ABC-12")
child = store.file("ABC-12", "Count the runs.", "", ())
self.assertEqual(store.rank(str(child), "ZZZ-1"), Failure("ZZZ-1 is not one of the child issues of the epic ABC-12, so it cannot be ranked"))
if __name__ == "__main__":
+5
View File
@@ -235,6 +235,11 @@ class RerankedTest(unittest.TestCase):
self.assertEqual(reranked(store, ["ABC-103", "ABC-102", "ABC-101", "ABC-100"]), Failure("cannot rank ABC-101 just before ABC-100: Jira answered 403; the re-rank stopped there, so rank the loop's issues in ABC-12's backlog by hand as ABC-103, ABC-102, ABC-101, ABC-100"))
self.assertEqual(store.asked, [("ABC-100", "ABC-103", True), ("ABC-101", "ABC-100", False)])
def test_a_refused_rank_after_the_last_issue_names_it(self) -> None:
store = epic()
store.refused = "ABC-100"
self.assertEqual(reranked(store, ["ABC-103", "ABC-102", "ABC-101", "ABC-100"]), Failure("cannot rank ABC-100 just after ABC-103: Jira answered 403; the re-rank stopped there, so rank the loop's issues in ABC-12's backlog by hand as ABC-103, ABC-102, ABC-101, ABC-100"))
def test_a_read_that_fails_ranks_nothing(self) -> None:
store = epic()
store.fails = "Jira is down"