diff options
author | 2018-02-22 14:32:46 -0500 | |
---|---|---|
committer | 2018-02-22 14:32:49 -0500 | |
commit | d1a814370eb3e45368af9d6a76f8ded77cca5c82 (patch) | |
tree | def567f5c53833ba75170517f5d00625438e66b9 /onap-dcae-cbs-docker-client/tests/test_client.py | |
parent | 44f0f8f2c3615b19b2c254fc3e2509116433e18a (diff) |
Implement the CBS 2.0.0 API
Change-Id: Iadf9e3d071ea24e240599fca2c13d1251e31f729
Issue-ID: DCAEGEN2-351
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.py | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/onap-dcae-cbs-docker-client/tests/test_client.py b/onap-dcae-cbs-docker-client/tests/test_client.py index db8e1b5..1e4ec13 100644 --- a/onap-dcae-cbs-docker-client/tests/test_client.py +++ b/onap-dcae-cbs-docker-client/tests/test_client.py @@ -15,8 +15,7 @@ # ============LICENSE_END========================================================= # # ECOMP is a trademark and service mark of AT&T Intellectual Property. -from onap_dcae_cbs_docker_client.client import get_config -import requests +from onap_dcae_cbs_docker_client.client import get_config, get_all class FakeResponse: def __init__(self, status_code, thejson): @@ -27,27 +26,28 @@ class FakeResponse: def json(self): return self.thejson -def test_client(monkeypatch): - - def monkeyed_requests_get(url): - #mock all the get calls for existent and non-existent - if url == "http://consuldotcom:8500/v1/catalog/service/config_binding_service": - return FakeResponse( - status_code = 200, - thejson = [ - {"ServiceAddress" : "666.666.666.666", - "ServicePort" : 8888 - }] - ) - elif url == "http://666.666.666.666:8888/service_component/mybestfrienddotcom": - return FakeResponse( - status_code = 200, - thejson = {"key_to_your_heart" : 666}) - - +def monkeyed_requests_get(url): + #mock all the get calls for existent and non-existent + if url == "http://consuldotcom:8500/v1/catalog/service/config_binding_service": + return FakeResponse(status_code=200, + thejson=[{"ServiceAddress": "666.666.666.666", + "ServicePort": 8888}]) + elif url == "http://666.666.666.666:8888/service_component_all/mybestfrienddotcom": + return FakeResponse(status_code=200, + thejson={"config": {"key_to_your_heart": 666}, + "dti": {"some amazing": "dti stuff"}, + "policies": {"event": {"foo": "bar"}, + "items": [{"foo2": "bar2"}]}, + "otherkey": {"foo3": "bar3"}}) + +def test_config(monkeypatch): monkeypatch.setattr('requests.get', monkeyed_requests_get) - assert(get_config() == {"key_to_your_heart" : 666}) - - - + assert(get_config() == {"key_to_your_heart": 666}) +def test_all(monkeypatch): + monkeypatch.setattr('requests.get', monkeyed_requests_get) + assert(get_all() == {"config": {"key_to_your_heart": 666}, + "dti": {"some amazing": "dti stuff"}, + "policies": {"event": {"foo": "bar"}, + "items": [{"foo2": "bar2"}]}, + "otherkey": {"foo3": "bar3"}}) |