diff --git a/bin/do_epic/backend/test_fake.py b/bin/do_epic/backend/test_fake.py index 24db7161..0d551f03 100644 --- a/bin/do_epic/backend/test_fake.py +++ b/bin/do_epic/backend/test_fake.py @@ -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__": diff --git a/bin/do_epic/test_ranking.py b/bin/do_epic/test_ranking.py index d4e4a414..9e19dce5 100644 --- a/bin/do_epic/test_ranking.py +++ b/bin/do_epic/test_ranking.py @@ -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"