# Path: heatclient/common/event_utils.py
# def get_hook_events(hc, stack_id, event_args, nested_depth=0,
#                     hook_type='pre-create'):
# def get_events(hc, stack_id, event_args, nested_depth=0,
#                marker=None, limit=None):
# def _get_nested_ids(hc, stack_id):
# def _get_nested_events(hc, nested_depth, stack_id, event_args):
# def _get_stack_name_from_links(event):
# def _get_stack_events(hc, stack_id, event_args):
# def poll_for_events(hc, stack_name, action=None, poll_period=5, marker=None,
#                     out=None, nested_depth=0):
#     def is_stack_event(event):
# def wait_for_events(ws, stack_name, out=None):
# 
# Path: heatclient/v1/events.py
# DEFAULT_PAGE_SIZE = 20
# class Event(base.Resource):
# class EventManager(stacks.StackChildManager):
#     def __repr__(self):
#     def update(self, **fields):
#     def delete(self):
#     def data(self, **kwargs):
#     def list(self, stack_id, resource_name=None, **kwargs):
#     def get(self, stack_id, resource_name, event_id):
# 
# Path: heatclient/v1/resources.py
# DEFAULT_PAGE_SIZE = 20
# class Resource(base.Resource):
# class ResourceManager(stacks.StackChildManager):
#     def __repr__(self):
#     def update(self, **fields):
#     def delete(self):
#     def data(self, **kwargs):
#     def stack_name(self):
#     def list(self, stack_id, **kwargs):
#     def get(self, stack_id, resource_name, with_attr=None):
#     def metadata(self, stack_id, resource_name):
#     def signal(self, stack_id, resource_name, data=None):
#     def mark_unhealthy(self, stack_id, resource_name,
#                        mark_unhealthy, resource_status_reason):
#     def generate_template(self, resource_name):


from unittest import mock
from heatclient.common import event_utils
from heatclient.v1 import events as hc_ev
from heatclient.v1 import resources as hc_res
import testtools
                                             stack_id='parent',
                                             event_args=ev_args)

        rsrc_calls = [mock.call(stack_id='parent'),
                      mock.call(stack_id='foo/child1'),
                      mock.call(stack_id='foo/child2')]
        mock_client.resources.list.assert_has_calls(rsrc_calls)
        ev_calls = [mock.call(stack_id='foo/child1', argfoo=123),
                    mock.call(stack_id='foo/child2', argfoo=123),
                    mock.call(stack_id='foo/child3', argfoo=123)]
        mock_client.events.list.assert_has_calls(ev_calls)
        self.assertEqual(3, len(evs))
        self.assertEqual('event1', evs[0].id)
        self.assertEqual('event2', evs[1].id)
        self.assertEqual('event3', evs[2].id)

    @mock.patch('heatclient.common.event_utils.get_events')
    def test_poll_for_events(self, ge):
        ge.side_effect = [[
            self._mock_stack_event('1', 'astack', 'CREATE_IN_PROGRESS'),
            self._mock_event('2', 'res_child1', 'CREATE_IN_PROGRESS'),
            self._mock_event('3', 'res_child2', 'CREATE_IN_PROGRESS'),
            self._mock_event('4', 'res_child3', 'CREATE_IN_PROGRESS')
        ], [
            self._mock_event('5', 'res_child1', 'CREATE_COMPLETE'),
            self._mock_event('6', 'res_child2', 'CREATE_COMPLETE'),
            self._mock_event('7', 'res_child3', 'CREATE_COMPLETE'),
            self._mock_stack_event('8', 'astack', 'CREATE_COMPLETE')
        ]]


# Path: heatclient/common/event_utils.py
# def get_hook_events(hc, stack_id, event_args, nested_depth=0,
#                     hook_type='pre-create'):
# def get_events(hc, stack_id, event_args, nested_depth=0,
#                marker=None, limit=None):
# def _get_nested_ids(hc, stack_id):
# def _get_nested_events(hc, nested_depth, stack_id, event_args):
# def _get_stack_name_from_links(event):
# def _get_stack_events(hc, stack_id, event_args):
# def poll_for_events(hc, stack_name, action=None, poll_period=5, marker=None,
#                     out=None, nested_depth=0):
#     def is_stack_event(event):
# def wait_for_events(ws, stack_name, out=None):
# 
# Path: heatclient/v1/events.py
# DEFAULT_PAGE_SIZE = 20
# class Event(base.Resource):
# class EventManager(stacks.StackChildManager):
#     def __repr__(self):
#     def update(self, **fields):
#     def delete(self):
#     def data(self, **kwargs):
#     def list(self, stack_id, resource_name=None, **kwargs):
#     def get(self, stack_id, resource_name, event_id):
# 
# Path: heatclient/v1/resources.py
# DEFAULT_PAGE_SIZE = 20
# class Resource(base.Resource):
# class ResourceManager(stacks.StackChildManager):
#     def __repr__(self):
#     def update(self, **fields):
#     def delete(self):
#     def data(self, **kwargs):
#     def stack_name(self):
#     def list(self, stack_id, **kwargs):
#     def get(self, stack_id, resource_name, with_attr=None):
#     def metadata(self, stack_id, resource_name):
#     def signal(self, stack_id, resource_name, data=None):
#     def mark_unhealthy(self, stack_id, resource_name,
#                        mark_unhealthy, resource_status_reason):
#     def generate_template(self, resource_name):


# Path: heatclient/tests/unit/test_event_utils.py
from unittest import mock
from heatclient.common import event_utils
from heatclient.v1 import events as hc_ev
from heatclient.v1 import resources as hc_res
import testtools

                                             stack_id='parent',
                                             event_args=ev_args)

        rsrc_calls = [mock.call(stack_id='parent'),
                      mock.call(stack_id='foo/child1'),
                      mock.call(stack_id='foo/child2')]
        mock_client.resources.list.assert_has_calls(rsrc_calls)
        ev_calls = [mock.call(stack_id='foo/child1', argfoo=123),
                    mock.call(stack_id='foo/child2', argfoo=123),
                    mock.call(stack_id='foo/child3', argfoo=123)]
        mock_client.events.list.assert_has_calls(ev_calls)
        self.assertEqual(3, len(evs))
        self.assertEqual('event1', evs[0].id)
        self.assertEqual('event2', evs[1].id)
        self.assertEqual('event3', evs[2].id)

    @mock.patch('heatclient.common.event_utils.get_events')
    def test_poll_for_events(self, ge):
        ge.side_effect = [[
            self._mock_stack_event('1', 'astack', 'CREATE_IN_PROGRESS'),
            self._mock_event('2', 'res_child1', 'CREATE_IN_PROGRESS'),
            self._mock_event('3', 'res_child2', 'CREATE_IN_PROGRESS'),
            self._mock_event('4', 'res_child3', 'CREATE_IN_PROGRESS')
        ], [
            self._mock_event('5', 'res_child1', 'CREATE_COMPLETE'),
            self._mock_event('6', 'res_child2', 'CREATE_COMPLETE'),
            self._mock_event('7', 'res_child3', 'CREATE_COMPLETE'),
            self._mock_stack_event('8', 'astack', 'CREATE_COMPLETE')
        ]]


        stack_status, msg = event_utils.poll_for_events(