Record do-epic's repo picks and sub-task summaries in the team's own spelling
CI / tests (pull_request) Failing after 2m33s
CI / tests (pull_request) Failing after 2m33s
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import json
|
||||
import pathlib
|
||||
import sys
|
||||
import tempfile
|
||||
@@ -60,6 +61,31 @@ class ConfigTest(unittest.TestCase):
|
||||
self.assertIn(fault, reason)
|
||||
self.assertEqual(reason.count("`label-repos` maps"), 7)
|
||||
|
||||
def test_reads_a_template_for_a_sub_tasks_summary(self) -> None:
|
||||
self.write(SETTINGS + 'sub-task-summary = "{label}: {Summary}"\n')
|
||||
found = load(self.home)
|
||||
assert isinstance(found, DoEpicConfig), found
|
||||
self.assertEqual(found.sub_task_summary, "{label}: {Summary}")
|
||||
|
||||
def test_leaves_a_sub_tasks_summary_to_its_default_where_the_config_has_no_template(self) -> None:
|
||||
self.write()
|
||||
found = load(self.home)
|
||||
assert isinstance(found, DoEpicConfig), found
|
||||
self.assertIsNone(found.sub_task_summary)
|
||||
|
||||
def test_refuses_a_template_that_is_no_one_line_with_summary_and_only_known_fields(self) -> None:
|
||||
for template, fault in (
|
||||
("4", "`sub-task-summary` is 4, not one line of text"),
|
||||
("a\\nb {Summary}", "not one line of text"),
|
||||
("{label}", "`sub-task-summary` lacks {Summary}"),
|
||||
("{label}: {Summary} {repo}", "`sub-task-summary` names {repo}, and only {label} and {Summary} are known"),
|
||||
("{Summary:>9}", "`sub-task-summary` holds a field with a format or conversion"),
|
||||
("{Summary", "`sub-task-summary` is '{Summary'"),
|
||||
):
|
||||
with self.subTest(template=template):
|
||||
self.write(SETTINGS + f"sub-task-summary = {template if template == '4' else json.dumps(template.replace(chr(92) + 'n', chr(10)))}\n")
|
||||
self.assertIn(fault, self.failure())
|
||||
|
||||
def test_refuses_a_label_repos_that_is_no_table(self) -> None:
|
||||
self.write('label-repos = "twu-4"\n' + SETTINGS)
|
||||
self.assertIn("`label-repos` is 'twu-4', not a table of labels, such as `twu-4 = \"tenant-web-ui-4\"` under `[label-repos]`", self.failure())
|
||||
|
||||
Reference in New Issue
Block a user