From 9ac66f97f426b5c510b9b0e3668270e7102e0dbb Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Tue, 8 Sep 2026 09:41:29 -0400 Subject: [PATCH] =?UTF-8?q?[REM]=20vpn=20:=20retirer=20la=20recherche=20de?= =?UTF-8?q?=20pr=C3=A9r=C3=A9glage=20que=20personne=20n'appelle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `presets.load(identifiant)` n'avait aucun appelant hors de son propre test : une interface publique inventée pour un besoin qui ne s'est pas présenté, et un test qui n'existait que parce qu'elle existait. Le menu liste par `load_all` et choisit par rang. Elle reviendra le jour où un CLI prendra un préréglage par son nom, avec le test que ce besoin justifiera. Vérifié : 48 tests des préréglages verts, et aucun appel résiduel dans script/ ni test/. --- EN --- `presets.load(identifier)` had no caller outside its own test: a public interface invented for a need that never arose, and a test that existed only because the interface did. The menu lists through `load_all` and picks by rank. It comes back the day a CLI takes a preset by name, with the test that need will justify. Checked: 48 preset tests green, and no remaining call in script/ or test/. Assisted-by: Claude Opus 5 --- script/vpn/presets.py | 9 --------- test/test_vpn_presets.py | 5 ----- 2 files changed, 14 deletions(-) diff --git a/script/vpn/presets.py b/script/vpn/presets.py index 1dc8859..c484764 100644 --- a/script/vpn/presets.py +++ b/script/vpn/presets.py @@ -159,15 +159,6 @@ def load_all(config=None) -> tuple[list[dict], list[str]]: return list(by_id.values()), errors -def load(identifier: str, config=None) -> dict | None: - """Le préréglage `identifier`, ou None.""" - found, _ = load_all(config) - for item in found: - if item["preset"] == identifier: - return item - return None - - def label(preset: dict) -> str: """Ce qu'on affiche. Le `label` s'il est là, l'identifiant sinon : un préréglage sans libellé reste choisissable.""" diff --git a/test/test_vpn_presets.py b/test/test_vpn_presets.py index 2ba6d16..0524cf1 100644 --- a/test/test_vpn_presets.py +++ b/test/test_vpn_presets.py @@ -159,11 +159,6 @@ class PresetLoading(unittest.TestCase): found, errors = presets.load_all() self.assertEqual((found, errors), ([], [])) - def test_load_finds_one_by_identifier(self): - write_preset(self.shared, "campus.json", PRESET) - self.assertEqual(presets.load("campus")["server"], PRESET["server"]) - self.assertIsNone(presets.load("nowhere")) - class PresetApplication(unittest.TestCase): """`apply` : d'un préréglage à un profil que la validation accepte."""