Repository: incubator-ariatosca Updated Branches: refs/heads/cli-tests 836bffba9 -> 5dbf61e7a
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/5555642d Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/5555642d Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/5555642d Branch: refs/heads/cli-tests Commit: 5555642d0cd6a719c4b7b22ac6f24fae08fdb13c Parents: 836bffb Author: Avia Efrat <[email protected]> Authored: Thu Apr 6 14:02:56 2017 +0300 Committer: Avia Efrat <[email protected]> Committed: Thu Apr 6 14:02: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/5555642d/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='')
