import pathlib import sys import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) from plan.todo_table import BLOCKED_BY from plan_store.contract import FIRST, SECOND from plan_store.fakes import MemoryPlan from larv_review.plan_listing import plan_listing class PlanListing(unittest.TestCase): def test_lists_each_item_with_its_release_tagline_blockers_and_detail_in_the_stores_order(self): plan = MemoryPlan(label="the epic ABC-12") plan.add(FIRST, "\nCount them where they are made.\n\nSay why.\n\n") plan.add(SECOND | {BLOCKED_BY: "1, 7"}, "") self.assertEqual(plan_listing(plan), ( "# Plan, as the epic ABC-12 holds it\n" "\n" "## Item 1, release 0.1.0\n" "\n" "**Count the runs.**\n" "\n" "Count them where they are made.\n" "\n" "Say why.\n" "\n" "## Item 2, release 0.2.0\n" "\n" "**Ship the later thing.**\n" "\n" "Blocked by: 1, 7.\n" )) def test_says_so_where_the_plan_holds_no_item(self): self.assertEqual(plan_listing(MemoryPlan(label="the epic ABC-12")), "# Plan, as the epic ABC-12 holds it\n\nThe plan holds no item.\n") def test_says_why_where_the_plan_cannot_be_read_so_a_reviewer_does_not_take_it_for_empty(self): self.assertEqual(plan_listing(MemoryPlan(label="the epic ABC-12", fails="Jira answered 401")), "# Plan, as the epic ABC-12 holds it\n\nThe plan cannot be read, so no item is listed: Jira answered 401\n") if __name__ == "__main__": unittest.main()