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/15 12:56:31 UTC
[04/19] incubator-ariatosca git commit: Fix tests in nodes list
Fix tests in nodes list
Project: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/commit/8b2da543
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/8b2da543
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/8b2da543
Branch: refs/heads/cli-tests
Commit: 8b2da543ea52988620cf768052083c67d558c8b1
Parents: 0058ee6
Author: Avia Efrat <av...@gigaspaces.com>
Authored: Sat Apr 15 14:07:38 2017 +0300
Committer: Avia Efrat <av...@gigaspaces.com>
Committed: Sat Apr 15 15:51:54 2017 +0300
----------------------------------------------------------------------
tests/cli/test_nodes.py | 42 +++++++++++++++++++++---------------------
1 file changed, 21 insertions(+), 21 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/blob/8b2da543/tests/cli/test_nodes.py
----------------------------------------------------------------------
diff --git a/tests/cli/test_nodes.py b/tests/cli/test_nodes.py
index 2313241..69c8827 100644
--- a/tests/cli/test_nodes.py
+++ b/tests/cli/test_nodes.py
@@ -53,24 +53,24 @@ class TestNodesList(TestCliBase):
assert 'test_s' in self.logger_output_string
assert 'test_n' in self.logger_output_string
- # @pytest.mark.parametrize('sort_by, order, sort_by_in_output, order_in_output', [
- # ('', '', 'service_name', 'asc'),
- # ('', ' --descending', 'service_name', 'desc'),
- # (' --sort-by name', '', 'name', 'asc'),
- # (' --sort-by name', ' --descending', 'name', 'desc')
- # ])
- # def test_list_specified_service(self, monkeypatch, mock_storage, sort_by, order,
- # sort_by_in_output, order_in_output):
- #
- # monkeypatch.setattr(Environment, 'model_storage', mock_storage)
- # self.invoke('nodes list{sort_by}{order}'.format(sort_by=sort_by,
- # order=order))
- # assert 'Listing nodes for service test_s...' not in self.logger_output_string
- # assert 'Listing all nodes...' in self.logger_output_string
- #
- # nodes_list = mock_storage.node.list
- # nodes_list.assert_called_once_with(sort={sort_by_in_output: order_in_output},
- # filters={})
- # assert 'Nodes:' in self.logger_output_string
- # assert 'test_s' in self.logger_output_string
- # assert 'test_n' in self.logger_output_string
+ @pytest.mark.parametrize('sort_by, order, sort_by_in_output, order_in_output', [
+ ('', '', 'service_name', 'asc'),
+ ('', ' --descending', 'service_name', 'desc'),
+ (' --sort-by name', '', 'name', 'asc'),
+ (' --sort-by name', ' --descending', 'name', 'desc')
+ ])
+ def test_list_no_specified_service(self, monkeypatch, mock_storage, sort_by, order,
+ sort_by_in_output, order_in_output):
+
+ monkeypatch.setattr(Environment, 'model_storage', mock_storage)
+ self.invoke('nodes list{sort_by}{order}'.format(sort_by=sort_by,
+ order=order))
+ assert 'Listing nodes for service test_s...' not in self.logger_output_string
+ assert 'Listing all nodes...' in self.logger_output_string
+
+ nodes_list = mock_storage.node.list
+ nodes_list.assert_called_once_with(sort={sort_by_in_output: order_in_output},
+ filters={})
+ assert 'Nodes:' in self.logger_output_string
+ assert 'test_s' in self.logger_output_string
+ assert 'test_n' in self.logger_output_string