Repository: incubator-ariatosca Updated Branches: refs/heads/cli-tests 007e1642e -> 7f370a9e1
Add test for storing a service template without exceptions Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/cba58712 Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/cba58712 Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/cba58712 Branch: refs/heads/cli-tests Commit: cba58712776ae6dc67917bb2ac7b063cb87657cb Parents: 007e164 Author: Avia Efrat <[email protected]> Authored: Wed Apr 5 18:12:40 2017 +0300 Committer: Avia Efrat <[email protected]> Committed: Wed Apr 5 18:12:40 2017 +0300 ---------------------------------------------------------------------- aria/cli/commands/service_templates.py | 1 - tests/cli/test_service_templates.py | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/cba58712/aria/cli/commands/service_templates.py ---------------------------------------------------------------------- diff --git a/aria/cli/commands/service_templates.py b/aria/cli/commands/service_templates.py index 90d02c1..e05492e 100644 --- a/aria/cli/commands/service_templates.py +++ b/aria/cli/commands/service_templates.py @@ -15,7 +15,6 @@ import os -import json from .. import utils from .. import csar http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/cba58712/tests/cli/test_service_templates.py ---------------------------------------------------------------------- diff --git a/tests/cli/test_service_templates.py b/tests/cli/test_service_templates.py index 4c2bf4d..87d859c 100644 --- a/tests/cli/test_service_templates.py +++ b/tests/cli/test_service_templates.py @@ -1,4 +1,6 @@ +from aria.cli import service_template_utils from aria.cli.env import Environment +from aria.core import Core from aria.storage import exceptions as storage_exceptions from tests.cli.base_test import TestCliBase, assert_exception_raised from tests.mock import models @@ -111,3 +113,13 @@ class TestServiceTemplatesList(TestCliBase): monkeypatch.setattr(Environment, 'model_storage', mock_object) self.invoke('service_templates list') mock_object.service_template.list.assert_called_with(sort={'created_at': 'asc'}) + + +class TestServiceTemplatesStore(TestCliBase): + + def test_store_no_exception(self, monkeypatch, mock_object): + + monkeypatch.setattr(Core, 'create_service_template', mock_object) + monkeypatch.setattr(service_template_utils, 'get', mock_object) + self.invoke('service_templates store stubpath test_st') + assert 'Service template test_st stored' in self.logger_output_string
