X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=mod%2Fdistributorapi%2Ftests%2Ftest_transform.py;h=5ee03acef70fa416e1b9eca4be31b553cd831044;hb=c83d2369eb2f0ac40d5acd2db2d7350fe86101e5;hp=f275e63ad0e601e4a2cde2c814205a5632d436cd;hpb=2b31b78fb0c6621259898c3553187be4ab0acf8a;p=dcaegen2%2Fplatform.git diff --git a/mod/distributorapi/tests/test_transform.py b/mod/distributorapi/tests/test_transform.py index f275e63..5ee03ac 100644 --- a/mod/distributorapi/tests/test_transform.py +++ b/mod/distributorapi/tests/test_transform.py @@ -1,5 +1,5 @@ # ============LICENSE_START======================================================= -# Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. +# Copyright (c) 2019-2022 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. @@ -18,11 +18,13 @@ from distributor import transform as tr TEST_DIR = os.path.dirname(__file__) + def _load_data(filename): path = os.path.join(TEST_DIR, filename) with open(path) as f: return json.load(f) + def _setup(): flow = _load_data("flow.json") components = _load_data("components.json") @@ -50,19 +52,18 @@ def test_make_fbp_from_flow(): assert list(sorted(expected)) == list(sorted(actual)) # Test processor to processor scenario - expected = {'metadata': {'data_type': 'json', - 'dmaap_type': 'MR', - 'name': 'foo-conn'}, - 'src': {'node': '75c9a179-b36b-4985-9445-d44c8768d6eb', - 'port': 'ves-pnfRegistration-secondary'}, - 'tgt': {'node': '3fadb641-2079-4ca9-bb07-0df5952967fc', - 'port': 'predict_subscriber'}} + expected = { + "metadata": {"data_type": "json", "dmaap_type": "MR", "name": "foo-conn"}, + "src": {"node": "75c9a179-b36b-4985-9445-d44c8768d6eb", "port": "ves-pnfRegistration-secondary"}, + "tgt": {"node": "3fadb641-2079-4ca9-bb07-0df5952967fc", "port": "predict_subscriber"}, + } actual = [e["payload"] for e in fbp if e["command"] == "addedge"] assert actual[0] == expected or actual[1] == expected # Test input port to processor scenario - expected = {'metadata': {'data_type': 'json', 'dmaap_type': 'MR', - 'name': 'ves-data-conn'}, 'src': {}, - 'tgt': {'node': '75c9a179-b36b-4985-9445-d44c8768d6eb', - 'port': 'ves-notification'}} + expected = { + "metadata": {"data_type": "json", "dmaap_type": "MR", "name": "ves-data-conn"}, + "src": {}, + "tgt": {"node": "75c9a179-b36b-4985-9445-d44c8768d6eb", "port": "ves-notification"}, + } assert actual[0] == expected or actual[1] == expected