aboutsummaryrefslogtreecommitdiffstats
path: root/app/app/tests/test_client.py
diff options
context:
space:
mode:
authorTommy Carpenter <tommy@research.att.com>2018-07-09 15:11:14 -0400
committerTommy Carpenter <tommy@research.att.com>2018-07-10 09:31:45 -0400
commit46ef692d3c1c9d57ad61bcc34bdac48eabf240b7 (patch)
tree52972cd3c311d66f69805a91df7aad86a7d81595 /app/app/tests/test_client.py
parente98e967740e58cf429b76b187828e3e0625215a5 (diff)
Finish EELF compliance.
Issue-ID: DCAEGEN2-581 Change-Id: I22651dbe775b0165612c507df99b5a0e8e2ee22c Signed-off-by: Tommy Carpenter <tommy@research.att.com>
Diffstat (limited to 'app/app/tests/test_client.py')
-rw-r--r--app/app/tests/test_client.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/app/app/tests/test_client.py b/app/app/tests/test_client.py
index 06a3dc2..cd3287c 100644
--- a/app/app/tests/test_client.py
+++ b/app/app/tests/test_client.py
@@ -1,11 +1,20 @@
from config_binding_service import client
+# pytest doesnt support objects in conftest
+class FakeReq(object):
+ """used to fake the logging params"""
+ def __init__(self):
+ self.path = "/unittest in {0}".format(__name__)
+ self.host = "localhost"
+ self.remote_addr = "6.6.6.6"
+
+
def test_consul_get_all_as_transaction(monkeypatch, monkeyed_requests_put):
"""tests _consul_get_all_as_transaction"""
monkeypatch.setattr('requests.put', monkeyed_requests_put)
allk = client._consul_get_all_as_transaction(
- "test_service_component_name.unknown.unknown.unknown.dcae.onap.org")
+ "test_service_component_name.unknown.unknown.unknown.dcae.onap.org", FakeReq(), "unit test xer")
assert allk == {
'test_service_component_name.unknown.unknown.unknown.dcae.onap.org': {'my': 'amazing config'},
'test_service_component_name.unknown.unknown.unknown.dcae.onap.org:dti': {'my': 'dti'},
@@ -16,15 +25,15 @@ def test_consul_get_all_as_transaction(monkeypatch, monkeyed_requests_put):
'test_service_component_name.unknown.unknown.unknown.dcae.onap.org:rels': ['my.amazing.relationship']
}
- allk = client._consul_get_all_as_transaction("cbs_test_messed_up")
+ allk = client._consul_get_all_as_transaction("cbs_test_messed_up", FakeReq(), "unit test xer")
assert allk == {'cbs_test_messed_up': {'foo': 'bar'},
'cbs_test_messed_up:badkey': 'INVALID JSON'}
def test_get_config_rels_dmaap(monkeypatch, monkeyed_requests_put):
monkeypatch.setattr('requests.put', monkeyed_requests_put)
- assert ({"foo3": "bar3"}, ["foo"], {"foo4": "bar4"}) == client._get_config_rels_dmaap("scn_exists")
- assert ({"foo5": "bar5"}, [], {}) == client._get_config_rels_dmaap("scn_exists_nord")
+ assert ({"foo3": "bar3"}, ["foo"], {"foo4": "bar4"}) == client._get_config_rels_dmaap("scn_exists", FakeReq(), "unit test xer")
+ assert ({"foo5": "bar5"}, [], {}) == client._get_config_rels_dmaap("scn_exists_nord", FakeReq(), "unit test xer")
def test_bad_config_http():