Example #1
0
 def test_search_stacks(self, mock_heat):
     fake_stacks = [
         fakes.FakeStack('001', 'stack1'),
         fakes.FakeStack('002', 'stack2'),
     ]
     mock_heat.stacks.list.return_value = fake_stacks
     stacks = self.cloud.search_stacks()
     mock_heat.stacks.list.assert_called_once_with()
     self.assertEqual(meta.obj_list_to_dict(fake_stacks), stacks)
Example #2
0
 def test_search_stacks_filters(self, mock_heat):
     fake_stacks = [
         fakes.FakeStack('001', 'stack1', status='GOOD'),
         fakes.FakeStack('002', 'stack2', status='BAD'),
     ]
     mock_heat.stacks.list.return_value = fake_stacks
     filters = {'stack_status': 'GOOD'}
     stacks = self.cloud.search_stacks(filters=filters)
     mock_heat.stacks.list.assert_called_once_with()
     self.assertEqual(meta.obj_list_to_dict(fake_stacks[:1]), stacks)
 def test_get_stack(self, mock_heat):
     stack = fakes.FakeStack('azerty', 'stack',)
     mock_heat.stacks.get.return_value = stack
     res = self.cloud.get_stack('stack')
     self.assertIsNotNone(res)
     self.assertEqual(stack.stack_name, res['stack_name'])
     self.assertEqual(stack.stack_name, res['name'])
     self.assertEqual(stack.stack_status, res['stack_status'])