ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [4/6] incubator-ariatosca git commit: Add tests for service-templates delete
Date Thu, 06 Apr 2017 14:31:16 GMT
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/ARIA-48-aria-cli
Commit: 81f8894ebca689950f1de13b124f481891223862
Parents: d54b397
Author: Avia Efrat <avia@gigaspaces.com>
Authored: Thu Apr 6 14:02:56 2017 +0300
Committer: Avia Efrat <avia@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='')


Mime
View raw message