summaryrefslogtreecommitdiffstats
path: root/onap-dcae-cbs-docker-client/tests/test_client.py
diff options
context:
space:
mode:
authorTommy Carpenter <tommy@research.att.com>2019-06-24 15:52:59 +0000
committerTommy Carpenter <tommy@research.att.com>2019-06-24 17:22:59 +0000
commit1474cbb0aec7a0636d4d53ad09eba501d9c75458 (patch)
treeb24ac03546c2ddf352b29a4ac4a60363a808edbf /onap-dcae-cbs-docker-client/tests/test_client.py
parent6778c62c6f9bfb7f6dc0123f268eb3f4e960b847 (diff)
Add CBS https/tls support
Issue-ID: DCAEGEN2-1551 Change-Id: I657d13ec87e051bd4836bd4c42385a580eaebe01 Signed-off-by: Tommy Carpenter <tommy@research.att.com>
Diffstat (limited to 'onap-dcae-cbs-docker-client/tests/test_client.py')
-rw-r--r--onap-dcae-cbs-docker-client/tests/test_client.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/onap-dcae-cbs-docker-client/tests/test_client.py b/onap-dcae-cbs-docker-client/tests/test_client.py
index b1589c2..132ab33 100644
--- a/onap-dcae-cbs-docker-client/tests/test_client.py
+++ b/onap-dcae-cbs-docker-client/tests/test_client.py
@@ -18,13 +18,29 @@ from onap_dcae_cbs_docker_client.client import get_config, get_all
from onap_dcae_cbs_docker_client.exceptions import CantGetConfig, CBSUnreachable, ENVsMissing
-def test_config(monkeypatch, monkeyed_requests_get):
+def test_http(monkeypatch, monkeyed_requests_get):
monkeypatch.setattr("requests.get", monkeyed_requests_get)
+
assert get_config() == {"key_to_your_heart": 666}
+ assert get_all() == {
+ "config": {"key_to_your_heart": 666},
+ "dti": {"some amazing": "dti stuff"},
+ "policies": {"event": {"foo": "bar"}, "items": [{"foo2": "bar2"}]},
+ "otherkey": {"foo3": "bar3"},
+ }
+
+
+def test_https_url(monkeypatch, monkeyed_requests_get_https):
+ """
+ this doesn't really test https; because of all the cert stuff,
+ however it tests that the url gets formed correctly in the presence of this env variable
+ """
+ monkeypatch.setattr("requests.get", monkeyed_requests_get_https)
+ monkeypatch.setenv("DCAE_CA_CERTPATH", "1")
+
+ assert get_config() == {"key_to_your_heart": 666}
-def test_all(monkeypatch, monkeyed_requests_get):
- monkeypatch.setattr("requests.get", monkeyed_requests_get)
assert get_all() == {
"config": {"key_to_your_heart": 666},
"dti": {"some amazing": "dti stuff"},