Write no changelog bullet for a plan kept in Jira: todo-item finish there needs no changelog flag and refuses --changelog
CI / tests (pull_request) Successful in 3m17s
CI / tests (pull_request) Successful in 3m17s
This commit is contained in:
@@ -4,10 +4,11 @@ import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
import unittest
|
||||
import unittest.mock
|
||||
|
||||
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parent.parent))
|
||||
|
||||
from project_config.test_project_config import configured
|
||||
from project_config.test_project_config import configured, JIRA_PLAN, JIRA_SCORING
|
||||
from plan.test_ranking import DECISIONS, README, TODO
|
||||
from project_config.settings import DEFAULT_FLOOR
|
||||
from todo_item import edits, main
|
||||
@@ -266,6 +267,40 @@ class Finish(TodoItem):
|
||||
self.assertEqual(self.todo.read_text(), before)
|
||||
|
||||
|
||||
class FinishInJira(TodoItem):
|
||||
"""A plan kept as a Jira epic keeps no changelog: the issues' history in Jira says what shipped."""
|
||||
|
||||
def setUp(self):
|
||||
super().setUp()
|
||||
self.config.write_text(self.config.read_text().replace('"checkout:todo.md"', f'"{JIRA_PLAN}"') + 'env-file = "~/acme.env"\n' + JIRA_SCORING)
|
||||
self.plan = MemoryPlan({3: {"Release": "0.1.0", "Item": "**Count the runs.**", "L": "1", "E": "2", "I": "3", "S": "1"}})
|
||||
patched = unittest.mock.patch.object(main, "plan_store", return_value=self.plan)
|
||||
patched.start()
|
||||
self.addCleanup(patched.stop)
|
||||
|
||||
def test_finishes_without_either_flag_and_leaves_a_changelog_that_exists_alone(self):
|
||||
self.changelog.write_text(CHANGELOG)
|
||||
self.assertEqual(self.run_main("finish", "3"), (0, "Finished item 3 in the plan in memory.\n", ""))
|
||||
self.assertEqual((self.plan.rows, self.changelog.read_text()), ({}, CHANGELOG))
|
||||
|
||||
def test_finishes_with_no_changelog_so_chunk_pr_merge_keeps_working(self):
|
||||
self.changelog.write_text(CHANGELOG)
|
||||
self.assertEqual(self.run_main("finish", "3", "--no-changelog"), (0, "Finished item 3 in the plan in memory.\n", ""))
|
||||
self.assertEqual(self.changelog.read_text(), CHANGELOG)
|
||||
|
||||
def test_refuses_a_bullet_writing_nothing_and_says_the_issues_history_is_the_changelog(self):
|
||||
self.changelog.write_text(CHANGELOG)
|
||||
code, out, err = self.run_main("finish", "3", "--changelog", "Runs are fast.")
|
||||
self.assertEqual((code, out), (1, ""))
|
||||
self.assertTrue(err.startswith("not finished: "), err)
|
||||
self.assertIn("the issues' history is the changelog", err)
|
||||
self.assertEqual((list(self.plan.rows), self.changelog.read_text()), ([3], CHANGELOG))
|
||||
|
||||
def test_doesnt_read_the_changelog(self):
|
||||
self.changelog.write_bytes(b"# Changelog\n\n\xff\n")
|
||||
self.assertEqual(self.run_main("finish", "3")[::2], (0, ""))
|
||||
|
||||
|
||||
class Show(TodoItem):
|
||||
def test_prints_the_header_the_row_and_the_detail(self):
|
||||
row = "| 3 | 0.1.0 | | | **Make it fast, `a \\| b`.** | 2 | 1 | 2 | 3 | 7 | 2.1 by 8, 1 by 6 |"
|
||||
|
||||
Reference in New Issue
Block a user