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/6e30d8a6 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/6e30d8a6 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/6e30d8a6 Branch: refs/heads/cli-tests Commit: 6e30d8a6cf25cee05e5a7af3be9ec5b9bddd63a2 Parents: 8d79b1e Author: Avia Efrat <[email protected]> Authored: Thu Apr 6 14:02:56 2017 +0300 Committer: Avia Efrat <[email protected]> Committed: Thu Apr 6 15:56:55 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/6e30d8a6/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='')
