You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ariatosca.apache.org by av...@apache.org on 2017/04/19 13:33:20 UTC
incubator-ariatosca git commit: Fix cli tests [ci-skip] [Forced
Update!]
Repository: incubator-ariatosca
Updated Branches:
refs/heads/ARIA-48-aria-cli 8a4665a8f -> 180dab81e (forced update)
Fix cli tests [ci-skip]
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/180dab81
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/180dab81
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/180dab81
Branch: refs/heads/ARIA-48-aria-cli
Commit: 180dab81e5614751dc9009f351d7763b0d73c3be
Parents: c16166c
Author: Avia Efrat <av...@gigaspaces.com>
Authored: Wed Apr 19 16:15:57 2017 +0300
Committer: Avia Efrat <av...@gigaspaces.com>
Committed: Wed Apr 19 16:32:27 2017 +0300
----------------------------------------------------------------------
aria/cli/commands/node_templates.py | 2 +-
aria/cli/commands/nodes.py | 4 ++--
aria/cli/commands/services.py | 2 +-
tests/cli/base_test.py | 2 +-
tests/cli/test_service_templates.py | 14 ++++++--------
tests/cli/test_services.py | 20 ++++++++------------
6 files changed, 19 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/180dab81/aria/cli/commands/node_templates.py
----------------------------------------------------------------------
diff --git a/aria/cli/commands/node_templates.py b/aria/cli/commands/node_templates.py
index 4d53f54..50c755e 100644
--- a/aria/cli/commands/node_templates.py
+++ b/aria/cli/commands/node_templates.py
@@ -88,6 +88,6 @@ def list(service_template_name, sort_by, descending, model_storage, logger):
node_templates_list = model_storage.node_template.list(
filters=filters,
- sort=utils.storage_sort_param(sort_by, descending)).items
+ sort=utils.storage_sort_param(sort_by, descending))
table.print_data(NODE_TEMPLATE_COLUMNS, node_templates_list, 'Node templates:')
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/180dab81/aria/cli/commands/nodes.py
----------------------------------------------------------------------
diff --git a/aria/cli/commands/nodes.py b/aria/cli/commands/nodes.py
index eeab338..e43493f 100644
--- a/aria/cli/commands/nodes.py
+++ b/aria/cli/commands/nodes.py
@@ -43,7 +43,7 @@ def show(node_id, model_storage, logger):
logger.info('Showing node {0}'.format(node_id))
node = model_storage.node.get(node_id)
- table.print_data(NODE_COLUMNS, node, 'Node:', 50)
+ table.print_data(NODE_COLUMNS, node, 'Node:', col_max_width=50)
# print node attributes
logger.info('Node attributes:')
@@ -82,6 +82,6 @@ def list(service_name,
nodes_list = model_storage.node.list(
filters=filters,
- sort=utils.storage_sort_param(sort_by, descending)).items
+ sort=utils.storage_sort_param(sort_by, descending))
table.print_data(NODE_COLUMNS, nodes_list, 'Nodes:')
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/180dab81/aria/cli/commands/services.py
----------------------------------------------------------------------
diff --git a/aria/cli/commands/services.py b/aria/cli/commands/services.py
index 1aa99f3..50b530a 100644
--- a/aria/cli/commands/services.py
+++ b/aria/cli/commands/services.py
@@ -66,7 +66,7 @@ def list(service_template_name,
services_list = model_storage.service.list(
sort=utils.storage_sort_param(sort_by=sort_by, descending=descending),
- filters=filters).items
+ filters=filters)
table.print_data(SERVICE_COLUMNS, services_list, 'Services:')
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/180dab81/tests/cli/base_test.py
----------------------------------------------------------------------
diff --git a/tests/cli/base_test.py b/tests/cli/base_test.py
index 4a1d4ab..da9d72c 100644
--- a/tests/cli/base_test.py
+++ b/tests/cli/base_test.py
@@ -55,7 +55,7 @@ class TestCliBase(object):
def assert_exception_raised(outcome, expected_exception, expected_msg=''):
assert isinstance(outcome.exception, expected_exception)
- assert expected_msg == str(outcome.exception)
+ assert expected_msg in str(outcome.exception)
# This exists as I wanted to mocked a function using monkeypatch to return a function that raises an
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/180dab81/tests/cli/test_service_templates.py
----------------------------------------------------------------------
diff --git a/tests/cli/test_service_templates.py b/tests/cli/test_service_templates.py
index 058853f..01b3f67 100644
--- a/tests/cli/test_service_templates.py
+++ b/tests/cli/test_service_templates.py
@@ -18,7 +18,6 @@ import mock
from aria.cli import service_template_utils, csar
from aria.cli.env import _Environment
-from aria.cli.exceptions import AriaCliError
from aria.core import Core
from aria.exceptions import AriaException
from aria.storage import exceptions as storage_exceptions
@@ -142,9 +141,8 @@ class TestServiceTemplatesStore(TestCliBase):
assert_exception_raised(
self.invoke('service_templates store stubpath test_st'),
- expected_exception=AriaCliError,
- expected_msg='Could not store service template `test_st`\n'
- 'There already a exists a service template with the same name')
+ expected_exception=storage_exceptions.NotFoundError,
+ expected_msg='There already a exists a service template with the same name')
def test_store_raises_exception(self, monkeypatch, mock_object):
@@ -155,7 +153,7 @@ class TestServiceTemplatesStore(TestCliBase):
assert_exception_raised(
self.invoke('service_templates store stubpath test_st'),
- expected_exception=AriaCliError)
+ expected_exception=storage_exceptions.StorageError)
class TestServiceTemplatesDelete(TestCliBase):
@@ -180,11 +178,11 @@ class TestServiceTemplatesDelete(TestCliBase):
monkeypatch.setattr(_Environment, 'model_storage', mock_object)
monkeypatch.setattr(Core,
'delete_service_template',
- raise_exception(storage_exceptions.NotFoundError))
+ raise_exception(storage_exceptions.StorageError))
assert_exception_raised(
self.invoke('service_templates delete test_st'),
- expected_exception=AriaCliError,
+ expected_exception=storage_exceptions.StorageError,
expected_msg='')
@@ -231,7 +229,7 @@ class TestServiceTemplatesValidate(TestCliBase):
monkeypatch.setattr(service_template_utils, 'get', mock_object)
assert_exception_raised(
self.invoke('service_templates validate stubpath'),
- expected_exception=AriaCliError)
+ expected_exception=AriaException)
class TestServiceTemplatesCreateArchive(TestCliBase):
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/180dab81/tests/cli/test_services.py
----------------------------------------------------------------------
diff --git a/tests/cli/test_services.py b/tests/cli/test_services.py
index d3da130..b1a6ee4 100644
--- a/tests/cli/test_services.py
+++ b/tests/cli/test_services.py
@@ -17,10 +17,9 @@ import pytest
import mock
from aria.cli.env import _Environment
-from aria.cli.exceptions import AriaCliError
from aria.core import Core
-from aria.exceptions import (AriaException, DependentActiveExecutionsError,
- DependentAvailableNodesError)
+from aria.exceptions import DependentActiveExecutionsError, DependentAvailableNodesError
+from aria.modeling.exceptions import InputsException
from aria.storage import exceptions as storage_exceptions
from .base_test import ( # pylint: disable=unused-import
@@ -100,9 +99,8 @@ class TestServicesCreate(TestCliBase):
msg='UNIQUE constraint failed'))
assert_exception_raised(
self.invoke('services create -t test_st test_s'),
- expected_exception=AriaCliError,
- expected_msg='Could not store service `test_s`\n'
- 'There already a exists a service with the same name')
+ expected_exception=storage_exceptions.NotFoundError,
+ expected_msg='There already a exists a service with the same name')
assert "Service created. The service's name is test_s" not in self.logger_output_string
@@ -114,22 +112,20 @@ class TestServicesCreate(TestCliBase):
assert_exception_raised(
self.invoke('services create -t test_st test_s'),
- expected_exception=AriaCliError)
+ expected_exception=storage_exceptions.NotFoundError)
assert "Service created. The service's name is test_s" not in self.logger_output_string
- def test_raises_aria_exception(self, monkeypatch, mock_storage):
+ def test_raises_inputs_exception(self, monkeypatch, mock_storage):
monkeypatch.setattr(_Environment, 'model_storage', mock_storage)
monkeypatch.setattr(Core,
'create_service',
- raise_exception(AriaException, msg='error creating service `test_s`'))
+ raise_exception(InputsException))
assert_exception_raised(
self.invoke('services create -t with_inputs test_s'),
- expected_exception=AriaCliError,
- expected_msg='error creating service `test_s`')
+ expected_exception=InputsException)
- assert 'error creating service `test_s`' in self.logger_output_string
assert "Service created. The service's name is test_s" not in self.logger_output_string