Pull JSON schemas at build/test not run time
[dcaegen2/platform.git] / adapter / acumos / tests / test_df.py
index cdf41c4..3872f35 100644 (file)
@@ -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.
 # ============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",