Kill the last surviving mutants of the sandbox and settings of the e2e command

This commit is contained in:
2026-11-19 04:04:13 +01:00
parent b709e03023
commit 7a798a9e37
2 changed files with 12 additions and 4 deletions
+4 -4
View File
@@ -31,15 +31,15 @@ def read(env: typing.Mapping[str, str]) -> Sandbox | Failure:
values = {name: env.get(name, "").strip() for name in MEANING}
url, project = values[JIRA_URL], values[PROJECT]
env_file = pathlib.Path(values[ENV_FILE]) if values[ENV_FILE] else None
absolute = env_file is not None and env_file.is_absolute()
usable = env_file if env_file is not None and env_file.is_absolute() else None
faults = [
*(f"{name} is missing: set it to {meaning}" for name, meaning in MEANING.items() if not values[name]),
*([f"{JIRA_URL} is {url!r}, not an https address without a path"] if url and not re.fullmatch(SITE, url) else []),
*([f"{PROJECT} is {project!r}, not a project key such as SBX"] if project and not re.fullmatch(PROJECT_KEY, project) else []),
*([f"{ENV_FILE} is {values[ENV_FILE]!r}, not an absolute path"] if env_file is not None and not absolute else []),
*([f"{ENV_FILE} is {values[ENV_FILE]!r}, not an absolute path"] if env_file is not None and usable is None else []),
]
if env_file is not None and absolute:
login = basic_auth(env_file)
if usable is not None:
login = basic_auth(usable)
if isinstance(login, Failure):
faults.append(login.reason)
if faults:
+8
View File
@@ -78,6 +78,14 @@ class EpicMadeTest(unittest.TestCase):
self.assertIn("holds no issues", str(left.exception))
self.assertEqual(jira.requests[1:], [("POST", "search/jql"), ("DELETE", "issue/SBX-1?deleteSubtasks=true")])
def test_deletes_the_epic_all_the_same_and_gives_the_reason_when_the_search_for_its_issues_is_refused(self) -> None:
jira = JiraStub(refuses="search/jql")
with self.assertRaises(Leftover) as left:
with epic_made(self.sandbox, "An epic", jira, lambda markdown: {"type": "doc"}):
pass
self.assertIn("POST https://acme.atlassian.net/rest/api/3/search/jql answered 403", str(left.exception))
self.assertEqual(jira.requests[1:], [("POST", "search/jql"), ("DELETE", "issue/SBX-1?deleteSubtasks=true")])
def test_yields_a_failure_and_deletes_nothing_when_the_epic_cannot_be_made(self) -> None:
jira = JiraStub(refuses="/issue")
with epic_made(self.sandbox, "An epic", jira, lambda markdown: {"type": "doc"}) as key: