1 # ============LICENSE_START====================================================
3 # =============================================================================
4 # Copyright (c) 2021 highstreet technologies GmbH. All rights reserved.
5 # =============================================================================
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 # ============LICENSE_END======================================================
20 Test the compatibility of Adapter while reading metadata from both previous (upto Clio) Acumos releases
21 and the new Demeter release.
25 import testing_helpers
28 def test_validate_format_Clio():
30 Given the metadata as per Acumos Clio's tree structure, check if the validate_json method
31 reads the correct input and output name
33 model_repo_path = testing_helpers.get_fixture_path('models')
34 model_name = 'example-model'
35 meta = aoconversion.utils.get_metadata(model_repo_path, model_name)
37 for method in meta["methods"]:
38 assert (aoconversion.utils.validate_format(meta, method, "input")) == "NumbersIn"
39 assert (aoconversion.utils.validate_format(meta, method, "output")) == "NumberOut"
42 def test_validate_format_Demeter():
44 Given the metadata as per Acumos Clio's tree structure, check if the validate_json method
45 can also read the correct input and output name without fail
47 model_repo_path = testing_helpers.get_fixture_path('models')
48 model_name = 'example-model-demeter'
49 meta = aoconversion.utils.get_metadata(model_repo_path, model_name)
51 for method in meta["methods"]:
52 assert (aoconversion.utils.validate_format(meta, method, "input")) == "NumbersIn"
53 assert (aoconversion.utils.validate_format(meta, method, "output")) == "NumbersOut"