generated from Hochfrequenz/python_template_repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🥅Catch Kroki HTTP 400 as "known error" in both Dot and Puml code paths (
#92) --------- Co-authored-by: Konstantin <konstantin.klein+github@hochfrequenz.de>
- Loading branch information
Showing
6 changed files
with
60 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
""" | ||
tests the main script | ||
""" | ||
|
||
from pathlib import Path | ||
from typing import Literal | ||
|
||
import pytest | ||
from _pytest.monkeypatch import MonkeyPatch | ||
|
||
from ebd_toolchain.main import _main | ||
|
||
repo_root = Path(__file__).parent.parent | ||
recent_docx_file = ( | ||
repo_root | ||
/ "edi_energy_mirror" | ||
/ "edi_energy_de" | ||
/ "FV2504" | ||
/ "Entscheidungsbaum-DiagrammeundCodelisten-informatorischeLesefassung4.0a_99991231_20250404.docx" | ||
) | ||
assert recent_docx_file.exists() | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"input_path, export_types", [pytest.param(recent_docx_file, ["puml", "dot", "json", "svg"], id="recent call")] | ||
) | ||
def test_main( | ||
input_path: Path, | ||
export_types: list[Literal["puml", "dot", "json", "svg"]], | ||
tmp_path: Path, | ||
monkeypatch: MonkeyPatch, | ||
) -> None: | ||
monkeypatch.setenv("KROKI_PORT", "8000") | ||
monkeypatch.setenv("KROKI_HOST", "localhost") | ||
# if you run into ConnectionErrors use | ||
# docker-compose up -d | ||
# in the repo root | ||
_main(input_path, tmp_path, export_types) | ||
# we don't assert on the results but instead just check that it doesn't crash |