Skip to content

Commit c747337

Browse files
author
Konstantin
committed
add snapshot
1 parent 9aca520 commit c747337

File tree

2 files changed

+473
-0
lines changed

2 files changed

+473
-0
lines changed

unittests/__snapshots__/test_ahbreader.ambr

Lines changed: 446 additions & 0 deletions
Large diffs are not rendered by default.

unittests/test_ahbreader.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
from fundamend.models.anwendungshandbuch import Anwendungsfall, Anwendungshandbuch, Bedingung, Paket, UbBedingung
88
from fundamend.reader import AhbReader
99

10+
from .conftest import is_private_submodule_checked_out
11+
1012

1113
@pytest.mark.parametrize(
1214
"ahb_xml_file_path, expected_date",
@@ -193,3 +195,28 @@ def test_anwendungshandbuch_hashable(ahb_xml_file_path: Path) -> None:
193195
assert isinstance(hash_code, int)
194196
hash_collection = set()
195197
hash_collection.add(ahb)
198+
199+
200+
_xml_submodule_root: Path = Path(__file__).parent.parent / "xml-migs-and-ahbs"
201+
202+
203+
@pytest.mark.snapshot()
204+
def test_sanitizing_all_awf_beschreibungen(snapshot: SnapshotAssertion) -> None:
205+
"""this test makes changes to the sanitation code visible."""
206+
if not is_private_submodule_checked_out():
207+
pytest.skip("Skipping test because of missing private submodule")
208+
all_sanitized_awf_beschreibungen: set[str] = set()
209+
for ahb_file_path in _xml_submodule_root.rglob("**/*AHB*.xml"):
210+
reader = AhbReader(ahb_file_path)
211+
ahb = reader.read()
212+
for awf in ahb.anwendungsfaelle:
213+
if awf.is_outdated:
214+
continue
215+
all_sanitized_awf_beschreibungen.add(awf.beschreibung)
216+
# If you're unhappy with any specific entry in this list, better write a new unit test case in
217+
# test_utils.py / test_anwendungsfall_beschreibung_normalization (add more parametrization).
218+
# If the snapshot test fails because of updated data, just run
219+
# tox -e snapshots
220+
# and commit the updated .ambr file.
221+
distinct_beschreibungen_as_list = list(sorted(all_sanitized_awf_beschreibungen))
222+
snapshot.assert_match(distinct_beschreibungen_as_list)

0 commit comments

Comments
 (0)