ariatosca-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [5/5] incubator-ariatosca git commit: Fix tests in nodes list
Date Sat, 15 Apr 2017 11:08:07 GMT
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/f4a3f525
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/tree/f4a3f525
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ariatosca/diff/f4a3f525

Branch: refs/heads/cli-tests
Commit: f4a3f5257623e0c732650ebe5f8493610e9f03d5
Parents: b683b33
Author: Avia Efrat <avia@gigaspaces.com>
Authored: Sat Apr 15 14:07:38 2017 +0300
Committer: Avia Efrat <avia@gigaspaces.com>
Committed: Sat Apr 15 14:07:38 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/f4a3f525/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


Mime
View raw message