X-Git-Url: https://gerrit.onap.org/r/gitweb?p=dcaegen2%2Fplatform.git;a=blobdiff_plain;f=adapter%2Facumos%2Ftests%2Ftest_df.py;fp=adapter%2Facumos%2Ftests%2Ftest_df.py;h=3872f35ca7cf6022d63cdb8768ff7d395a032fc4;hp=cdf41c41807a705f7c8bd1db867411797e8d838a;hb=711d4eae913f34e78aa10e8cd511f3b8e43cd54f;hpb=a1a37bde3365ebf0aaa543b2f10ebdb13bd4af40 diff --git a/adapter/acumos/tests/test_df.py b/adapter/acumos/tests/test_df.py index cdf41c4..3872f35 100644 --- a/adapter/acumos/tests/test_df.py +++ b/adapter/acumos/tests/test_df.py @@ -1,7 +1,7 @@ # ============LICENSE_START==================================================== # org.onap.dcae # ============================================================================= -# Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2019-2020 AT&T Intellectual Property. All rights reserved. # ============================================================================= # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,23 +17,21 @@ # ============LICENSE_END====================================================== from testing_helpers import get_json_fixture, get_fixture_path -from aoconversion import dataformat_gen +from aoconversion import dataformat_gen, utils TEST_META = get_json_fixture("models/example-model/metadata.json") -DRAFT_4_SCHEMA = get_json_fixture("jsdraft4schema.json") -DF_101 = get_json_fixture("dataformat_101.json") def test_get_needed_formats(): assert dataformat_gen._get_needed_formats(TEST_META) == ["NumbersIn", "NumberOut"] -def test_generate_dcae_data_formats(): +def test_generate_dcae_data_formats(mock_schemas): """ Test generating data formats from the protobuf """ test_proto_path = get_fixture_path("models/example-model/model.proto") - assert dataformat_gen._generate_dcae_data_formats(test_proto_path, TEST_META, DF_101, DRAFT_4_SCHEMA) == [ + assert dataformat_gen._generate_dcae_data_formats(test_proto_path, TEST_META, utils.dataformat_schema.get(), utils.schema_schema.get()) == [ { "self": {"name": "NumbersIn", "version": "1.0.0"}, "dataformatversion": "1.0.1", @@ -62,14 +60,14 @@ def test_generate_dcae_data_formats(): ] -def test_generate_dcae_data_formats_listofm(): +def test_generate_dcae_data_formats_listofm(mock_schemas): """ Test generating data formats from the protobuf This one tests the case where definitions needs to be populated in one of the data formats because it's referenced in a "top level" message """ test_meta = get_json_fixture("models/example-model-listofm/metadata.json") test_proto_path = get_fixture_path("models/example-model-listofm/model.proto") - assert dataformat_gen._generate_dcae_data_formats(test_proto_path, test_meta, DF_101, DRAFT_4_SCHEMA) == [ + assert dataformat_gen._generate_dcae_data_formats(test_proto_path, test_meta, utils.dataformat_schema.get(), utils.schema_schema.get()) == [ { "self": {"name": "ArgsList", "version": "1.0.0"}, "dataformatversion": "1.0.1",