diff options
author | Alex Shatov <alexs@att.com> | 2018-03-23 14:35:12 -0400 |
---|---|---|
committer | Alex Shatov <alexs@att.com> | 2018-03-23 14:35:12 -0400 |
commit | 8534af4f1ef5be3c6f946913824d5ed807e2321c (patch) | |
tree | 7f883519886a43d6664d698f2f319ae4b4cc4353 /dcae-policy/tests | |
parent | 19a075b395d687753de0f0266842cb9af8f24682 (diff) |
2.1.0 dcaepolicyplugin and data types
- configAttributes in policy_filter being a stringified json,
rather than the map due to SDC UI limitations
- safely parse the configAttributes string into json
Change-Id: I934b6254aed285ddab245b440f43403a4fe918fe
Signed-off-by: Alex Shatov <alexs@att.com>
Issue-ID: DCAEGEN2-413
Diffstat (limited to 'dcae-policy/tests')
-rw-r--r-- | dcae-policy/tests/__init__.py | 1 | ||||
-rw-r--r-- | dcae-policy/tests/log_ctx.py | 1 | ||||
-rw-r--r-- | dcae-policy/tests/mock_cloudify_ctx.py | 2 | ||||
-rw-r--r-- | dcae-policy/tests/test_tasks.py | 16 |
4 files changed, 11 insertions, 9 deletions
diff --git a/dcae-policy/tests/__init__.py b/dcae-policy/tests/__init__.py index e5e8bc9..5d59d8b 100644 --- a/dcae-policy/tests/__init__.py +++ b/dcae-policy/tests/__init__.py @@ -1,4 +1,3 @@ -# org.onap.dcae # ================================================================================ # Copyright (c) 2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ diff --git a/dcae-policy/tests/log_ctx.py b/dcae-policy/tests/log_ctx.py index 51d3c67..0d82687 100644 --- a/dcae-policy/tests/log_ctx.py +++ b/dcae-policy/tests/log_ctx.py @@ -1,4 +1,3 @@ -# org.onap.dcae # ================================================================================ # Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ diff --git a/dcae-policy/tests/mock_cloudify_ctx.py b/dcae-policy/tests/mock_cloudify_ctx.py index 574d561..eab7ab1 100644 --- a/dcae-policy/tests/mock_cloudify_ctx.py +++ b/dcae-policy/tests/mock_cloudify_ctx.py @@ -1,5 +1,3 @@ -# ============LICENSE_START======================================================= -# org.onap.dcae # ================================================================================ # Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ diff --git a/dcae-policy/tests/test_tasks.py b/dcae-policy/tests/test_tasks.py index 94bbbd5..9bcf4ff 100644 --- a/dcae-policy/tests/test_tasks.py +++ b/dcae-policy/tests/test_tasks.py @@ -1,5 +1,3 @@ -# ============LICENSE_START======================================================= -# org.onap.dcae # ================================================================================ # Copyright (c) 2017-2018 AT&T Intellectual Property. All rights reserved. # ================================================================================ @@ -39,6 +37,7 @@ POLICY_NAME = "policyName" POLICY_BODY = 'policy_body' POLICY_CONFIG = 'config' LATEST_POLICIES = "latest_policies" +CONFIG_NAME = "ConfigName" MONKEYED_POLICY_ID = 'monkeyed.Config_peach' LOG_FILE = 'logs/test_dcaepolicyplugin.log' @@ -88,7 +87,7 @@ class MonkeyedPolicyBody(object): POLICY_CONFIG: config, "matchingConditions": { "ONAPName": "DCAE", - "ConfigName": "alex_config_name" + CONFIG_NAME: "alex_config_name" }, "responseAttributes": {}, "property": None @@ -235,7 +234,7 @@ def monkeyed_policy_handler_find(full_path, json, headers): {LATEST_POLICIES: { MONKEYED_POLICY_ID: MonkeyedPolicyBody.create_policy(MONKEYED_POLICY_ID)}}) -def test_policy_find(monkeypatch): +def test_policies_find(monkeypatch): """test policy_get operation on dcae.nodes.policies node""" monkeypatch.setattr('requests.post', monkeyed_policy_handler_find) @@ -243,7 +242,14 @@ def test_policy_find(monkeypatch): 'test_dcae_policies_node_id', 'test_dcae_policies_node_name', tasks.DCAE_POLICIES_TYPE, - {tasks.POLICY_FILTER: {POLICY_NAME: MONKEYED_POLICY_ID}} + { + tasks.POLICY_FILTER: { + POLICY_NAME: MONKEYED_POLICY_ID, + tasks.CONFIG_ATTRIBUTES: json.dumps({ + CONFIG_NAME: "alex_config_name" + }) + } + } ) try: |