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:23 UTC

[14/18] incubator-ariatosca git commit: Add tests for service-templates delete

Add tests for service-templates delete


Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/81f8894e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/81f8894e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/81f8894e

Branch: refs/heads/logger_task
Commit: 81f8894ebca689950f1de13b124f481891223862
Parents: d54b397
Author: Avia Efrat <av...@gigaspaces.com>
Authored: Thu Apr 6 14:02:56 2017 +0300
Committer: Avia Efrat <av...@gigaspaces.com>
Committed: Thu Apr 6 17:29:56 2017 +0300

----------------------------------------------------------------------
 tests/cli/test_service_templates.py | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/81f8894e/tests/cli/test_service_templates.py
----------------------------------------------------------------------
diff --git a/tests/cli/test_service_templates.py b/tests/cli/test_service_templates.py
index d0daf59..9d210c1 100644
--- a/tests/cli/test_service_templates.py
+++ b/tests/cli/test_service_templates.py
@@ -141,3 +141,25 @@ class TestServiceTemplatesStore(TestCliBase):
             expected_exception=AriaCliError,
             expected_msg='Could not store service template `test_st`\n'
                          'There already a exists a service template with the same name')
+
+
+class TestServiceTemplatesDelete(TestCliBase):
+
+    def test_delete_no_exception(self, monkeypatch, mock_object):
+
+        monkeypatch.setattr(Environment, 'model_storage', mock_object)
+        monkeypatch.setattr(Core, 'delete_service_template', mock_object)
+        self.invoke('service_templates delete test_st')
+        assert 'Service template test_st deleted' in self.logger_output_string
+
+    def test_delete_raises_exception(self, monkeypatch, mock_object):
+
+        monkeypatch.setattr(Environment, 'model_storage', mock_object)
+        monkeypatch.setattr(Core,
+                            'delete_service_template',
+                            raise_exception(storage_exceptions.NotFoundError))
+
+        assert_exception_raised(
+            self.invoke('service_templates delete test_st'),
+            expected_exception=AriaCliError,
+            expected_msg='')