🤖 Option pour écarter les fiches sans Direction ni téléphone

Avec skip_without_group_and_phone: true dans mapping.yaml, une fiche
dont l'attribut Direction est vide et qui n'a aucun téléphone n'est
pas synchronisée (et est supprimée du carnet si elle y est). Un code
Direction inconnu de directions.yaml ne compte pas comme vide.
L'option est désactivée par défaut ; le nombre de fiches écartées est
journalisé.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
zeguiguiandClaude Opus 5.5 committed 2026-11-17 19:42:35 +01:00
1 parent 35f90b8fb1
commit 6d8ec287ec
8 files changed
+102 -4

No files matched your search

+17
View File
@@ -144,3 +144,20 @@ def test_load_directions_example_file():
d = load_directions(ROOT / "directions.example.yaml")
assert len(d) == 3
assert d["620"] == "Direction des systèmes d'information"
def test_skip_without_group_and_phone_defaults_to_false(tmp_path):
assert mapping_with_photo(tmp_path, "").skip_without_group_and_phone is False
def test_skip_without_group_and_phone_is_read(tmp_path):
path = tmp_path / "mapping.yaml"
path.write_text("key: uid\nskip_without_group_and_phone: true\nfields:\n given_name: givenName\n family_name: sn\n")
assert load_mapping(path).skip_without_group_and_phone is True
def test_skip_without_group_and_phone_must_be_boolean(tmp_path):
path = tmp_path / "mapping.yaml"
path.write_text("key: uid\nskip_without_group_and_phone: oui\nfields:\n given_name: givenName\n family_name: sn\n")
with pytest.raises(ConfigError, match="skip_without_group_and_phone"):
load_mapping(path)