diff --git a/bin/do_epic/backend/test_jira.py b/bin/do_epic/backend/test_jira.py index 5d930326..037509f6 100644 --- a/bin/do_epic/backend/test_jira.py +++ b/bin/do_epic/backend/test_jira.py @@ -366,6 +366,15 @@ class Jira(Case): self.assertEqual(store.file("ABC-78", "Count more.", "", ()), Failure("ABC-78 is neither the epic ABC-12 nor one of its child issues, so nothing can be filed under it")) self.assertEqual([call for call in self.jira.calls if call[0] == "POST" and call[1] == ISSUES], []) + def test_refuses_to_file_blocked_by_a_sub_task_of_another_epics_child_or_an_issue_it_cannot_read(self) -> None: + self.jira.issues.extend([{"key": "ABC-6", "fields": {"parent": {"key": "ABC-7"}, "status": TO_DO}}, {"key": "ABC-5", "fields": {"parent": {"key": "ABC-6"}, "status": TO_DO}}]) + store = self.new_store() + self.assertEqual(store.file("ABC-12", "Count more.", "", (), "ABC-5"), Failure("ABC-5 is neither a child issue of the epic ABC-12 nor a sub-task of one, so it cannot block a new issue")) + self.assertEqual(store.file("ABC-12", "Count more.", "", (), "ABC-77"), Failure(f"cannot read ABC-77 to file blocked by it: Jira answered 404 for GET {ISSUES}/ABC-77?fields=parent,status")) + self.jira.answers[("GET", f"{ISSUES}/ABC-6?fields=parent,status")] = Failure("Jira answered 503") + self.assertEqual(store.file("ABC-12", "Count more.", "", (), "ABC-5"), Failure("cannot read ABC-6 to file blocked by it: Jira answered 503")) + self.assertEqual([call for call in self.jira.calls if call[0] == "POST" and call[1] == ISSUES], []) + def test_a_label_jira_refuses_is_not_added(self) -> None: store = self.new_store() key = store.file("ABC-12", "Count the runs.", "", ()) diff --git a/bin/do_epic/test_findings.py b/bin/do_epic/test_findings.py index 40db0d24..2e4ed59d 100644 --- a/bin/do_epic/test_findings.py +++ b/bin/do_epic/test_findings.py @@ -4,6 +4,7 @@ import fcntl import io import pathlib import sys +import unittest sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1])) @@ -12,7 +13,7 @@ from do_epic.epic_record import EpicRecord from failure import Failure from loop_effects.doubles import FakeEffects from record_store.held import Held -from do_epic import main +from do_epic import findings, main from do_epic.backend.fake import MemoryEpic from loop_state.paths import paths_from @@ -137,6 +138,13 @@ class FilingAFinding(FindingsTest): self.assertEqual((code, out, err, len(self.store.issues)), (1, "", main.HELP + "\n", 2)) +class Instructions(unittest.TestCase): + def test_say_nothing_of_a_next_pull_request_without_the_chunks_issue(self) -> None: + told = findings.instructions("ABC-12", pathlib.Path("/b/do-epic"), "Swedish") + self.assertTrue(told.endswith("its text on stdin. Write the issue and the decision in Swedish, the epic's language."), told) + self.assertNotIn("--blocked-by", told) + + class RecordingADecision(FindingsTest): def test_appends_the_entry_to_the_descriptions_decisions(self) -> None: code, out, err, fake = self.run_with(["ABC-12", "--record-decision", "Imports retry three times"], "2026-11-18, the human's answer. Valid while the client's API rate-limits.\n")