Skip to content

Commit 18b0866

Browse files
committed
tests: adapt fuzzer for timetable v2
1 parent 39c3cf8 commit 18b0866

20 files changed

+784
-2
lines changed

tests/conftest.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from tests.scenario import Scenario
1111
from tests.services import EDITOAST_URL
1212
from tests.test_e2e import FAST_ROLLING_STOCK_JSON_PATH, TestRollingStock
13-
from tests.utils.timetable import create_scenario
13+
from tests.utils.timetable import create_scenario, create_scenario_v2
1414

1515

1616
def _load_generated_infra(name: str) -> int:
@@ -80,6 +80,12 @@ def small_scenario(small_infra: Infra, foo_project_id: int, foo_study_id: int) -
8080
yield Scenario(foo_project_id, foo_study_id, scenario_id, small_infra.id, timetable_id)
8181

8282

83+
@pytest.fixture
84+
def small_scenario_v2(small_infra: Infra, foo_project_id: int, foo_study_id: int) -> Iterator[Scenario]:
85+
scenario_id, timetable_id = create_scenario_v2(EDITOAST_URL, small_infra.id, foo_project_id, foo_study_id)
86+
yield Scenario(foo_project_id, foo_study_id, scenario_id, small_infra.id, timetable_id)
87+
88+
8389
def get_rolling_stock(editoast_url: str, rolling_stock_name: str) -> int:
8490
"""
8591
Returns the ID corresponding to the rolling stock name, if available.

tests/fuzzer/fuzzer.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def make_error(
8383
error = "" if response.content is None else response.content.decode("utf-8")
8484
raise FailedTest(
8585
{
86+
"timetable_version": 1,
8687
"error_type": error_type.value,
8788
"code": response.status_code,
8889
"error": error,
@@ -282,7 +283,7 @@ def run(
282283
print(e)
283284
log_folder.mkdir(exist_ok=True)
284285
with open(str(log_folder / f"{i}.json"), "w") as f:
285-
print(json.dumps(e.args[0], indent=4), file=f)
286+
print(json.dumps(e.args[0], indent=4, default=lambda o: "<not serializable>"), file=f)
286287

287288
# Let's reset the scenario (empty timetable) so we can keep a
288289
# manageable/reproducible state.

0 commit comments

Comments
 (0)