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 13:58:22 UTC
[06/17] incubator-ariatosca git commit: Add test for show
service-template with description
Add test for show service-template with 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/9a2befc0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/9a2befc0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/9a2befc0
Branch: refs/heads/cli-tests
Commit: 9a2befc004ae816da03160e81f26f962aeb361db
Parents: bd2904e
Author: Avia Efrat <av...@gigaspaces.com>
Authored: Wed Apr 5 11:31:58 2017 +0300
Committer: Avia Efrat <av...@gigaspaces.com>
Committed: Wed Apr 5 16:49:57 2017 +0300
----------------------------------------------------------------------
tests/cli/test_service_templates.py | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/9a2befc0/tests/cli/test_service_templates.py
----------------------------------------------------------------------
diff --git a/tests/cli/test_service_templates.py b/tests/cli/test_service_templates.py
index 8e1fa65..d5cea10 100644
--- a/tests/cli/test_service_templates.py
+++ b/tests/cli/test_service_templates.py
@@ -11,17 +11,31 @@ class MockStorage(object):
class MockServiceTemplateStorage(object):
- def get(self, id_):
- if id_ == '1': # a service-template with no description and no services.
- st = ServiceTemplate()
- st.name = 'test_st'
+ def get(self, id):
+ st = ServiceTemplate()
+ st.name = 'test_st'
+ if id == '1': # no services and no description.
st.services = []
- return st
+ if id == '2': # no services, but an description
+ st.description = 'test_description'
+ st.services = []
+ return st
class TestServiceTemplatesShow(TestCliBase):
def test_show_no_services_no_description(self, monkeypatch):
- # reroute the logger to a special location, and check it's content.
+
monkeypatch.setattr(Environment, 'model_storage', MockStorage())
outcome = self.invoke('service_templates show 1')
+
+ assert 'Description:' not in self.logger_output_string
+ assert 'Existing services:\n[]' in self.logger_output_string
+
+ def test_show_no_services_yes_description(self, monkeypatch):
+
+ monkeypatch.setattr(Environment, 'model_storage', MockStorage())
+ outcome = self.invoke('service_templates show 2')
+
+ assert 'Description:\ntest_description' in self.logger_output_string
+ assert 'Existing services:\n[]' in self.logger_output_string