aboutsummaryrefslogtreecommitdiffstats
path: root/python_moonutilities/tests/unit_python
diff options
context:
space:
mode:
authorsgdt6900 <rhanafy.ext@orange.com>2018-01-11 16:14:59 +0200
committersgdt6900 <rhanafy.ext@orange.com>2018-01-11 16:14:59 +0200
commite7e664ddd6264718f700f8a529abd2c1663dcfcb (patch)
tree3173bd4cbc64e81431da76937d20db3c43017d16 /python_moonutilities/tests/unit_python
parent626dc28a44b92a2bfe6473bf0b595dfee71e4d61 (diff)
adding tests for the change "interface - pipline"
Change-Id: I0f302ca240e03f43ffd47822b548721174c37a86 Signed-off-by: sgdt6900 <rhanafy.ext@orange.com>
Diffstat (limited to 'python_moonutilities/tests/unit_python')
-rw-r--r--python_moonutilities/tests/unit_python/mock_repo/urls.py5
-rw-r--r--python_moonutilities/tests/unit_python/test_configuration.py10
2 files changed, 10 insertions, 5 deletions
diff --git a/python_moonutilities/tests/unit_python/mock_repo/urls.py b/python_moonutilities/tests/unit_python/mock_repo/urls.py
index 634f07b1..41fd1eec 100644
--- a/python_moonutilities/tests/unit_python/mock_repo/urls.py
+++ b/python_moonutilities/tests/unit_python/mock_repo/urls.py
@@ -8,10 +8,7 @@ def register_components(m):
'GET', 'http://consul:8500/v1/kv/{}'.format(component),
json=[{'Key': component, 'Value': comp_util.get_b64_conf(component)}]
)
- m.register_uri(
- 'GET', 'http://consul:8500/v1/kv/components/port_start',
- json=[{'Key': 'components/port_start', 'Value': comp_util.get_b64_conf("components/port_start")}]
- )
+
m.register_uri(
'PUT', 'http://consul:8500/v1/kv/components/port_start',
json=[]
diff --git a/python_moonutilities/tests/unit_python/test_configuration.py b/python_moonutilities/tests/unit_python/test_configuration.py
index 5267179e..d5d83f7a 100644
--- a/python_moonutilities/tests/unit_python/test_configuration.py
+++ b/python_moonutilities/tests/unit_python/test_configuration.py
@@ -98,7 +98,15 @@ def test_get_plugins_success():
plugin = configuration.get_plugins()
assert plugin is not None
-
+def test_get_plugins_failure(no_requests):
+ from python_moonutilities import configuration
+ no_requests.register_uri(
+ 'GET', 'http://consul:8500/v1/kv/components/pipeline',
+ json=[{'Key': 'components/pipeline', 'Value': 'eyJjb250YWluZXIiOiAid3Vrb25nc3VuL21vb25fYXV0aHo6djQuMyIsICJwb3J0IjogODA4MX0='}]
+ )
+ with pytest.raises(Exception) as exception_info:
+ configuration.get_plugins()
+ assert str(exception_info.value) == '500: Consul Content error'
################################ component ####################################
def test_get_components():
from python_moonutilities import configuration