[REM] vpn : retirer la recherche de préréglage que personne n'appelle

`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
This commit is contained in:
Mathieu Benoit 2026-09-08 09:41:29 -04:00
parent ae2909dd0f
commit 9ac66f97f4
2 changed files with 0 additions and 14 deletions

View file

@ -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."""

View file

@ -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."""