You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by av...@apache.org on 2017/04/05 10:05:53 UTC
[06/10] incubator-ariatosca git commit: Add testing service templates
with a service and a description
Add testing service templates with a service and a description
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/be27ea00
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/be27ea00
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/be27ea00
Branch: refs/heads/cli-tests
Commit: be27ea006e3311b895c4e7324d72399002ce6c46
Parents: 1a3123c
Author: Avia Efrat <av...@gigaspaces.com>
Authored: Wed Apr 5 11:58:25 2017 +0300
Committer: Avia Efrat <av...@gigaspaces.com>
Committed: Wed Apr 5 11:59:12 2017 +0300
----------------------------------------------------------------------
tests/cli/test_service_templates.py | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/be27ea00/tests/cli/test_service_templates.py
----------------------------------------------------------------------
diff --git a/tests/cli/test_service_templates.py b/tests/cli/test_service_templates.py
index d5cea10..d35139e 100644
--- a/tests/cli/test_service_templates.py
+++ b/tests/cli/test_service_templates.py
@@ -1,6 +1,6 @@
from aria.cli.env import Environment
from base_test import TestCliBase
-from aria.modeling.models import ServiceTemplate
+from aria.modeling.models import ServiceTemplate, Service
class MockStorage(object):
@@ -19,6 +19,11 @@ class MockServiceTemplateStorage(object):
if id == '2': # no services, but an description
st.description = 'test_description'
st.services = []
+ if id == '3': # one service, and a description
+ service = Service()
+ service.name = 'test_s'
+ st.description = 'test_description'
+ st.services = [service]
return st
@@ -39,3 +44,11 @@ class TestServiceTemplatesShow(TestCliBase):
assert 'Description:\ntest_description' in self.logger_output_string
assert 'Existing services:\n[]' in self.logger_output_string
+
+ def test_show_one_service_yes_description(self, monkeypatch):
+
+ monkeypatch.setattr(Environment, 'model_storage', MockStorage())
+ outcome = self.invoke('service_templates show 3')
+
+ assert 'Description:\ntest_description' in self.logger_output_string
+ assert 'Existing services:\n["test_s"]' in self.logger_output_string