From 1ebe4411534db9a37a0b209c014115197b1f207b Mon Sep 17 00:00:00 2001 From: Peter Razumovsky Date: Fri, 26 Sep 2014 19:12:52 +0400 Subject: [PATCH] Add tests for list_stacks and count_stacks params There are no tests for show_deleted and show_nested params in list_stacks and no test for show_deleted param in count_stacks. Methods' return depends on these params, so this patch test correct using of these params. Change-Id: I08a68ac7c1b1f5abeeadf8563a6b347ecee6e369 --- heat/tests/test_engine_service.py | 37 +++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/heat/tests/test_engine_service.py b/heat/tests/test_engine_service.py index 19fc7895b..3e2613aad 100644 --- a/heat/tests/test_engine_service.py +++ b/heat/tests/test_engine_service.py @@ -1834,6 +1834,34 @@ class StackServiceTest(HeatTestCase): mock.ANY, ) + @mock.patch.object(db_api, 'stack_get_all') + def test_stack_list_show_nested(self, mock_stack_get_all): + self.eng.list_stacks(self.ctx, show_nested=True) + mock_stack_get_all.assert_called_once_with(mock.ANY, + mock.ANY, + mock.ANY, + mock.ANY, + mock.ANY, + mock.ANY, + mock.ANY, + mock.ANY, + True, + ) + + @mock.patch.object(db_api, 'stack_get_all') + def test_stack_list_show_deleted(self, mock_stack_get_all): + self.eng.list_stacks(self.ctx, show_deleted=True) + mock_stack_get_all.assert_called_once_with(mock.ANY, + mock.ANY, + mock.ANY, + mock.ANY, + mock.ANY, + mock.ANY, + mock.ANY, + True, + mock.ANY, + ) + @mock.patch.object(db_api, 'stack_count_all') def test_count_stacks_passes_filter_info(self, mock_stack_count_all): self.eng.count_stacks(self.ctx, filters={'foo': 'bar'}) @@ -1870,6 +1898,15 @@ class StackServiceTest(HeatTestCase): show_deleted=False, show_nested=True) + @mock.patch.object(db_api, 'stack_count_all') + def test_count_stack_show_deleted(self, mock_stack_count_all): + self.eng.count_stacks(self.ctx, show_deleted=True) + mock_stack_count_all.assert_called_once_with(mock.ANY, + filters=mock.ANY, + tenant_safe=True, + show_deleted=True, + show_nested=False) + @stack_context('service_abandon_stack') def test_abandon_stack(self): self.m.StubOutWithMock(parser.Stack, 'load')