1 # ============LICENSE_START====================================================
3 # =============================================================================
4 # Copyright (c) 2020 AT&T Intellectual Property. All rights reserved.
5 # Copyright (c) 2021 highstreet technologies GmbH. All rights reserved.
6 # =============================================================================
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 # ============LICENSE_END======================================================
25 from tests import testing_helpers
29 def mock_schemas(monkeypatch):
31 schemadir = cwd[:cwd.find('/adapter/acumos')] + '/mod/component-json-schemas'
32 monkeypatch.setattr(aoconversion.utils.component_schema, 'path', schemadir + '/component-specification/dcae-cli-v3/component-spec-schema.json')
33 monkeypatch.setattr(aoconversion.utils.dataformat_schema, 'path', schemadir + '/data-format/dcae-cli-v1/data-format-schema.json')
34 monkeypatch.setattr(aoconversion.utils.schema_schema, 'ret', requests.get('https://json-schema.org/draft-04/schema#').json())
37 def test_get_metadata():
38 model_repo_path = testing_helpers.get_fixture_path('models')
39 model_name = 'example-model'
40 assert (aoconversion.utils.get_metadata(model_repo_path, model_name) == {
41 "schema": "acumos.schema.model:0.4.0",
44 "encoding": "protobuf",
66 "name": "example-model",
70 "output": "NumberOut",
71 "description": "Adds two integers"