# Path: heatclient/v1/stacks.py
# class Stack(base.Resource):
# class StackChildManager(base.BaseManager):
# class StackManager(StackChildManager):
#     def __repr__(self):
#     def preview(self, **fields):
#     def create(self, **fields):
#     def update(self, **fields):
#     def delete(self):
#     def abandon(self):
#     def snapshot(self, name=None):
#     def snapshot_show(self, snapshot_id):
#     def snapshot_delete(self, snapshot_id):
#     def restore(self, snapshot_id):
#     def snapshot_list(self):
#     def output_list(self):
#     def output_show(self, output_key):
#     def environment(self):
#     def files(self):
#     def get(self):
#     def action(self):
#     def status(self):
#     def identifier(self):
#     def api(self):
#     def _resolve_stack_id(self, stack_id):
#     def list(self, **kwargs):
#         def paginate(params):
#     def preview(self, **kwargs):
#     def create(self, **kwargs):
#     def update(self, stack_id, **kwargs):
#     def preview_update(self, stack_id, **kwargs):
#     def delete(self, stack_id):
#     def abandon(self, stack_id):
#     def export(self, stack_id):
#     def snapshot(self, stack_id, name=None):
#     def snapshot_show(self, stack_id, snapshot_id):
#     def snapshot_delete(self, stack_id, snapshot_id):
#     def restore(self, stack_id, snapshot_id):
#     def snapshot_list(self, stack_id):
#     def output_list(self, stack_id):
#     def output_show(self, stack_id, output_key):
#     def get(self, stack_id, resolve_outputs=True):
#     def template(self, stack_id):
#     def environment(self, stack_id):
#     def files(self, stack_id):
#     def validate(self, **kwargs):


from unittest import mock
from testscenarios import scenarios as scnrs
from heatclient.v1 import stacks
import testscenarios
import testtools

        self.result_index = 0
        results = list(manager.list(**list_params))

        # assert that the list method has been called enough times
        self.assertEqual(len(self.results), self.result_index)

        last_result = min(self.limit, self.total - self.offset)
        # one or more list calls have been recomposed into a single list
        self.assertEqual(last_result, len(results))

        if last_result > 0:
            self.assertEqual('stack_%s' % (self.offset + 1),
                             results[0].stack_name)
            self.assertEqual('stack_%s' % (self.offset + last_result),
                             results[-1].stack_name)


class StackManagerValidateTest(testtools.TestCase):

    def setUp(self):
        super(StackManagerValidateTest, self).setUp()

        self.mock_response = mock.MagicMock()
        self.mock_response.json.return_value = {'result': 'fake_response'}
        self.mock_response.headers = {'content-type': 'application/json'}

        self.mock_client = mock.MagicMock()
        self.mock_client.post.return_value = self.mock_response


# Path: heatclient/v1/stacks.py
# class Stack(base.Resource):
# class StackChildManager(base.BaseManager):
# class StackManager(StackChildManager):
#     def __repr__(self):
#     def preview(self, **fields):
#     def create(self, **fields):
#     def update(self, **fields):
#     def delete(self):
#     def abandon(self):
#     def snapshot(self, name=None):
#     def snapshot_show(self, snapshot_id):
#     def snapshot_delete(self, snapshot_id):
#     def restore(self, snapshot_id):
#     def snapshot_list(self):
#     def output_list(self):
#     def output_show(self, output_key):
#     def environment(self):
#     def files(self):
#     def get(self):
#     def action(self):
#     def status(self):
#     def identifier(self):
#     def api(self):
#     def _resolve_stack_id(self, stack_id):
#     def list(self, **kwargs):
#         def paginate(params):
#     def preview(self, **kwargs):
#     def create(self, **kwargs):
#     def update(self, stack_id, **kwargs):
#     def preview_update(self, stack_id, **kwargs):
#     def delete(self, stack_id):
#     def abandon(self, stack_id):
#     def export(self, stack_id):
#     def snapshot(self, stack_id, name=None):
#     def snapshot_show(self, stack_id, snapshot_id):
#     def snapshot_delete(self, stack_id, snapshot_id):
#     def restore(self, stack_id, snapshot_id):
#     def snapshot_list(self, stack_id):
#     def output_list(self, stack_id):
#     def output_show(self, stack_id, output_key):
#     def get(self, stack_id, resolve_outputs=True):
#     def template(self, stack_id):
#     def environment(self, stack_id):
#     def files(self, stack_id):
#     def validate(self, **kwargs):


# Path: heatclient/tests/unit/test_stacks.py
from unittest import mock
from testscenarios import scenarios as scnrs
from heatclient.v1 import stacks
import testscenarios
import testtools


        self.result_index = 0
        results = list(manager.list(**list_params))

        # assert that the list method has been called enough times
        self.assertEqual(len(self.results), self.result_index)

        last_result = min(self.limit, self.total - self.offset)
        # one or more list calls have been recomposed into a single list
        self.assertEqual(last_result, len(results))

        if last_result > 0:
            self.assertEqual('stack_%s' % (self.offset + 1),
                             results[0].stack_name)
            self.assertEqual('stack_%s' % (self.offset + last_result),
                             results[-1].stack_name)


class StackManagerValidateTest(testtools.TestCase):

    def setUp(self):
        super(StackManagerValidateTest, self).setUp()

        self.mock_response = mock.MagicMock()
        self.mock_response.json.return_value = {'result': 'fake_response'}
        self.mock_response.headers = {'content-type': 'application/json'}

        self.mock_client = mock.MagicMock()
        self.mock_client.post.return_value = self.mock_response


        self.manager = stacks.StackManager(self.mock_client)