You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by mx...@apache.org on 2017/04/10 09:51:20 UTC
[11/18] incubator-ariatosca git commit: Add tests for
service-templates inputs
Add tests for service-templates inputs
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/54f3f52c
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/54f3f52c
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/54f3f52c
Branch: refs/heads/logger_task
Commit: 54f3f52cab9688df1b9eb7df3bab0de159ee2d22
Parents: fe6ee15
Author: Avia Efrat <av...@gigaspaces.com>
Authored: Thu Apr 6 15:54:26 2017 +0300
Committer: Avia Efrat <av...@gigaspaces.com>
Committed: Thu Apr 6 17:29:56 2017 +0300
----------------------------------------------------------------------
tests/cli/test_service_templates.py | 23 +++++++++++++++++++++++
tests/mock/models.py | 5 +++++
2 files changed, 28 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/54f3f52c/tests/cli/test_service_templates.py
----------------------------------------------------------------------
diff --git a/tests/cli/test_service_templates.py b/tests/cli/test_service_templates.py
index c98bc7e..3d5a8fb 100644
--- a/tests/cli/test_service_templates.py
+++ b/tests/cli/test_service_templates.py
@@ -44,6 +44,16 @@ class MockServiceTemplateStorage(object):
st.services = [service]
return st
+ @staticmethod
+ def get_by_name(name):
+ st = models.create_service_template('test_st')
+ if name == 'with_inputs':
+ input = models.create_input(name='input1', value='value1')
+ st.inputs = {'input1': input}
+ if name == 'without_inputs':
+ st.inputs = {}
+ return st
+
class TestServiceTemplatesShow(TestCliBase):
@@ -175,3 +185,16 @@ class TestServiceTemplatesDelete(TestCliBase):
self.invoke('service_templates delete test_st'),
expected_exception=AriaCliError,
expected_msg='')
+
+
+class TestServiceTemplatesInputs(TestCliBase):
+
+ def test_inputs_existing_inputs(self, monkeypatch):
+ monkeypatch.setattr(Environment, 'model_storage', MockStorage())
+ self.invoke('service_templates inputs with_inputs')
+ assert 'input1' in self.logger_output_string and 'value1' in self.logger_output_string
+
+ def test_inputs_no_inputs(self, monkeypatch):
+ monkeypatch.setattr(Environment, 'model_storage', MockStorage())
+ self.invoke('service_templates inputs without_inputs')
+ assert 'No inputs' in self.logger_output_string
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/54f3f52c/tests/mock/models.py
----------------------------------------------------------------------
diff --git a/tests/mock/models.py b/tests/mock/models.py
index 6b7f810..9771fe2 100644
--- a/tests/mock/models.py
+++ b/tests/mock/models.py
@@ -221,6 +221,11 @@ def create_plugin_specification(name='test_plugin', version='0.1'):
)
+def create_input(name, value):
+ p = models.Parameter()
+ return p.wrap(name, value)
+
+
def _dictify(item):
return dict(((item.name, item),))