From 877742a2b0055a9722b0132c3ca4af86b67c55ea Mon Sep 17 00:00:00 2001 From: Andrea Franchini <hello@andreafranchini.com> Date: Thu, 16 Mar 2023 13:52:14 +0100 Subject: [PATCH] Fix mc_openapi tests --- mc_openapi/doml_mc/common_reqs.py | 4 ++-- mc_openapi/handlers.py | 3 ++- tests/test_mc_openapi.py | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/mc_openapi/doml_mc/common_reqs.py b/mc_openapi/doml_mc/common_reqs.py index c64922c..23e4ac3 100644 --- a/mc_openapi/doml_mc/common_reqs.py +++ b/mc_openapi/doml_mc/common_reqs.py @@ -554,9 +554,9 @@ def ed_vm_iface(solver: Solver, smtsorts: SMTSorts, intermediate_model: Intermed vm_name = get_user_friendly_name( intermediate_model, solver.model(), vm) if vm_name: - return f"Virtual machine {vm_name} is connected to no network interface." + return f"Virtual machine {vm_name} is not connected to any network interface." except: - return "A virtual machine is connected to no network interface." + return "A virtual machine is not connected to any network interface." def ed_software_package_iface_net(solver: Solver, smtsorts: SMTSorts, intermediate_model: IntermediateModel) -> str: diff --git a/mc_openapi/handlers.py b/mc_openapi/handlers.py index 76828fb..0b71b79 100644 --- a/mc_openapi/handlers.py +++ b/mc_openapi/handlers.py @@ -36,7 +36,8 @@ def post(body, version=None): user_req_str_consts = [] # Add support for Requirements in DOML - if dmc.doml_version == DOMLVersion.V2_2: + if (dmc.doml_version == DOMLVersion.V2_2 + or dmc.doml_version == DOMLVersion.V2_2_1): domlr_parser = Parser(DOMLRTransformer) model = get_pyecore_model(doml_xmi, DOMLVersion.V2_2) func_reqs = model.functionalRequirements.items diff --git a/tests/test_mc_openapi.py b/tests/test_mc_openapi.py index 506b33b..5f777dd 100644 --- a/tests/test_mc_openapi.py +++ b/tests/test_mc_openapi.py @@ -28,12 +28,12 @@ def test_post_faas_unsat_V2_0(): def test_post_common_reqs_V2_0(): check_strings = [ - "is connected to no network interface.", + "is not connected to any network interface.", "but they are deployed to nodes that cannot communicate through a common network.", "share the same IP address.", "is not deployed to any abstract infrastructure node.", - "has not been mapped to any element in the active concretization.", - "is mapped to no abstract infrastructure element." + "is not mapped to any element in the active concretization.", + "is not mapped to any abstract infrastructure element." ] for req, err_desc in zip(CommonRequirements[DOMLVersion.V2_0].get_all_requirements(), check_strings): -- GitLab