aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Duval <thomas.duval@orange.com>2017-11-29 08:52:39 +0100
committerThomas Duval <thomas.duval@orange.com>2017-11-29 08:53:04 +0100
commit1a4e9d90b2e0773e0d5d6f1a6741d40e901fd006 (patch)
treeba4962b5066d68ac000c953380dd824466a9210d
parentd72e7ce30ebc098a6832b32d1a1155b1a7efd51c (diff)
Fix a bug in unittest
Change-Id: I9ef73c7c2f85eb8e72bf34d0095df8bdef86f2a9
-rw-r--r--moonv4/moon_utilities/tests/unit_python/conftest.py15
-rw-r--r--moonv4/moon_utilities/tests/unit_python/test_cache.py3
2 files changed, 11 insertions, 7 deletions
diff --git a/moonv4/moon_utilities/tests/unit_python/conftest.py b/moonv4/moon_utilities/tests/unit_python/conftest.py
index 177a406e..487c2f0e 100644
--- a/moonv4/moon_utilities/tests/unit_python/conftest.py
+++ b/moonv4/moon_utilities/tests/unit_python/conftest.py
@@ -125,17 +125,19 @@ COMPONENTS = (
"database",
"slave",
"components/manager",
+ "components/orchestrator",
+ "components/interface",
)
def get_b64_conf(component=None):
- if component in CONF:
+ if component == "components":
+ return base64.b64encode(
+ json.dumps(CONF["components"]).encode('utf-8')+b"\n").decode('utf-8')
+ elif component in CONF:
return base64.b64encode(
json.dumps(
CONF[component]).encode('utf-8')+b"\n").decode('utf-8')
- elif component == "components":
- return base64.b64encode(
- json.dumps(CONF["components"]).encode('utf-8')+b"\n").decode('utf-8')
elif not component:
return base64.b64encode(
json.dumps(CONF).encode('utf-8')+b"\n").decode('utf-8')
@@ -158,7 +160,10 @@ def no_requests(monkeypatch):
)
m.register_uri(
'GET', 'http://consul:8500/v1/kv/components?recurse=true',
- json=[{'Key': "components", 'Value': get_b64_conf("components")}]
+ json=[
+ {"Key": key, "Value": get_b64_conf(key)} for key in COMPONENTS
+ ],
+ # json={'Key': "components", 'Value': get_b64_conf("components")}
)
m.register_uri(
'POST', 'http://keystone:5000/v3/auth/tokens',
diff --git a/moonv4/moon_utilities/tests/unit_python/test_cache.py b/moonv4/moon_utilities/tests/unit_python/test_cache.py
index 5ecacfcf..15c5f22a 100644
--- a/moonv4/moon_utilities/tests/unit_python/test_cache.py
+++ b/moonv4/moon_utilities/tests/unit_python/test_cache.py
@@ -2,5 +2,4 @@
def test_cache():
from moon_utilities import cache
c = cache.Cache()
- r = c.authz_requests()
- assert isinstance(r, dict)
+ assert isinstance(c.authz_requests, dict)