Kill the surviving mutants of the env-file failure message and config_of

This commit is contained in:
2026-11-13 20:27:34 +01:00
parent db88211599
commit e758bf1a91
2 changed files with 9 additions and 1 deletions
+4
View File
@@ -256,6 +256,10 @@ class Dm(Project):
assert isinstance(failed, Failure), failed
self.assertEqual(failed.reason, f"{self.folder / 'config.toml'} sets no `env-file`; it needs the file that holds MATTERMOST_URL, MATTERMOST_TOKEN and MATTERMOST_RECIPIENT")
def test_config_of_reads_the_env_file_the_config_names(self):
self.name_env_file("MATTERMOST_URL=https://chat.example/\nMATTERMOST_TOKEN=secret-token\nMATTERMOST_RECIPIENT=lilleman\n")
self.assertEqual(dm.config_of(str(self.checkout), self.home), CONFIG)
def test_no_failure_it_gives_holds_the_token_however_the_request_fails(self):
self.name_env_file("MATTERMOST_URL=https://127.0.0.1:1\nMATTERMOST_TOKEN=secret-token\nMATTERMOST_RECIPIENT=lilleman\n")
failed = dm.dm("Which one?", str(self.checkout), self.home, dm.http_json)
+5 -1
View File
@@ -9,7 +9,7 @@ import unittest.mock
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1]))
from failure import Failure
from project_config.settings import held, load, ProjectConfig, SETTINGS
from project_config.settings import held, load, OUTSIDE, ProjectConfig, SETTINGS
from test_env import isolated_env
TOOL = pathlib.Path(__file__).resolve().parents[1] / "project-config"
@@ -179,6 +179,10 @@ class LoadTest(ConfigCase):
self.assertIn("`env-file`", reason)
self.assertNotIn("is not a setting", reason)
def test_the_failure_for_a_misplaced_env_file_and_a_missing_setting_names_both_and_lists_every_setting(self) -> None:
folder = self.write("acme", "".join(line + "\n" for line in CLIENT.splitlines() if not line.startswith("plan")) + 'env-file = "checkout:.env"\n')
self.assertEqual(self.failure(), f"{folder / 'config.toml'}: `plan` is missing; `env-file` is 'checkout:.env', not {OUTSIDE}. The settings are {', '.join(SETTINGS)}, and optionally env-file.")
def test_two_configs_naming_one_checkout_fail_naming_both(self) -> None:
self.write("acme", CLIENT)
self.write("acme-copy", CLIENT)