Skip to content

Commit 536b7fc

Browse files
author
Issam Kadar
committed
feat/converter : add test that assert raise error when rs-sr with unknown resourceId in persisted rs-ri
1 parent 37b961c commit 536b7fc

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

converter/tests/cisu/test_resources_status_converter.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import json
33
from pathlib import Path
44
from unittest.mock import patch
5+
import pytest
56

67
from converter.cisu.resources_status.resources_status_converter import (
78
ResourcesStatusConverter,
@@ -109,3 +110,21 @@ def test_from_rs_to_cisu_no_rs_ri():
109110
):
110111
result = ResourcesStatusConverter.from_rs_to_cisu(rs_sr_new)
111112
assert result == []
113+
114+
115+
def test_from_rs_to_cisu_resource_not_in_rs_ri():
116+
unknown_resource_id = "fr.fire.sis076.cgo-076.resource.UNKNOWN_VLM"
117+
rs_sr = make_rs_sr(_CASE_ID, unknown_resource_id, "ARRIVEE")
118+
rs_ri = make_rs_ri(_CASE_ID) # RS-RI only has VLM1 and VLM2
119+
120+
with (
121+
patch(
122+
"converter.cisu.resources_status.resources_status_converter.get_last_rs_ri_by_case_id",
123+
return_value=persisted(rs_ri),
124+
),
125+
pytest.raises(
126+
ValueError,
127+
match=f"Resource '{unknown_resource_id}' from RS-SR not found in RS-RI for caseId '{_CASE_ID}'",
128+
),
129+
):
130+
ResourcesStatusConverter.from_rs_to_cisu(rs_sr)

0 commit comments

Comments
 (0)