|
32 | 32 |
|
33 | 33 | # Dictionnaire des cas d'erreur : file_name -> message attendu |
34 | 34 | ERROR_CASES = { |
35 | | - **{ |
36 | | - name: "No states found in resource, mandatory for CISU conversion." |
37 | | - for name in usecase_files_with_empty_state |
38 | | - }, |
39 | | - **{ |
40 | | - name: "At least one resource must have a CISU compatible vehicleType." |
41 | | - for name in usecase_files_with_unsupported_vehicle_type |
42 | | - }, |
| 35 | + name: "No states found in resource, mandatory for CISU conversion." |
| 36 | + for name in usecase_files_with_empty_state |
43 | 37 | } |
44 | 38 |
|
45 | 39 | TEST_CASES = [ |
46 | 40 | (name, ValueError, ERROR_CASES[name]) if name in ERROR_CASES else (name, None, None) |
47 | 41 | for name in all_file_names |
| 42 | + if name not in usecase_files_with_unsupported_vehicle_type |
48 | 43 | ] |
49 | 44 |
|
50 | 45 |
|
@@ -85,6 +80,21 @@ def test_rs_to_cisu(file_name, expected_exception, expected_message): |
85 | 80 | ResourcesInfoCISUConverter.from_rs_to_cisu(edxl_json) |
86 | 81 |
|
87 | 82 |
|
| 83 | +@pytest.mark.parametrize( |
| 84 | + "file_name", |
| 85 | + usecase_files_with_unsupported_vehicle_type, |
| 86 | +) |
| 87 | +def test_rs_to_cisu_returns_empty_list_when_no_cisu_compatible_resource(file_name): |
| 88 | + """Quand toutes les ressources ont un vehicleType non supporté, from_rs_to_cisu |
| 89 | + doit retourner [] au lieu de lever une erreur.""" |
| 90 | + usecase_file = next(f for f in all_usecase_files if f["name"] == file_name) |
| 91 | + edxl_json = TestHelper.create_edxl_json_from_sample( |
| 92 | + TestConstants.EDXL_HEALTH_TO_FIRE_ENVELOPE_PATH, usecase_file["path"] |
| 93 | + ) |
| 94 | + result = ResourcesInfoCISUConverter.from_rs_to_cisu(edxl_json) |
| 95 | + assert result == [] |
| 96 | + |
| 97 | + |
88 | 98 | def test_rs_to_cisu_should_delete_patient_id(): |
89 | 99 | rs_raw_message = TestHelper.create_edxl_json_from_sample( |
90 | 100 | TestConstants.EDXL_HEALTH_TO_FIRE_ENVELOPE_PATH, |
|
0 commit comments