# Path: heatclient/exc.py
# class BaseException(Exception):
# class CommandError(BaseException):
# class InvalidEndpoint(BaseException):
# class CommunicationError(BaseException):
# class HTTPException(BaseException):
# class HTTPMultipleChoices(HTTPException):
# class BadRequest(HTTPException):
# class HTTPBadRequest(BadRequest):
# class Unauthorized(HTTPException):
# class HTTPUnauthorized(Unauthorized):
# class Forbidden(HTTPException):
# class HTTPForbidden(Forbidden):
# class NotFound(HTTPException):
# class HTTPNotFound(NotFound):
# class NoUniqueMatch(HTTPException):
# class HTTPMethodNotAllowed(HTTPException):
# class Conflict(HTTPException):
# class HTTPConflict(Conflict):
# class OverLimit(HTTPException):
# class HTTPOverLimit(OverLimit):
# class HTTPUnsupported(HTTPException):
# class HTTPInternalServerError(HTTPException):
# class HTTPNotImplemented(HTTPException):
# class HTTPBadGateway(HTTPException):
# class ServiceUnavailable(HTTPException):
# class HTTPServiceUnavailable(ServiceUnavailable):
# class NoTokenLookupException(Exception):
# class EndpointNotFound(Exception):
# class StackFailure(Exception):
#     def __init__(self, message=None):
#     def __str__(self):
#     def __init__(self, message=None, code=None):
#     def __str__(self):
#     def __str__(self):
# def from_response(response):
# 
# Path: heatclient/osc/v1/stack_failures.py
# class ListStackFailures(command.Command):
#     def take_action(self, parsed_args):
#     def get_parser(self, prog_name):
#     def _build_failed_resources(self, stack):
#     def _append_failed_resources(self, failures, resources, resource_path):
#     def _build_software_deployments(self, resources):
#     def _print_failures(self, failures, deployment_failures, long=False):
# 
# Path: heatclient/tests/unit/osc/v1/fakes.py
# class TestOrchestrationv1(utils.TestCommand):
#     def setUp(self):


import collections
from unittest import mock
from heatclient import exc
from heatclient.osc.v1 import stack_failures
from heatclient.tests.unit.osc.v1 import fakes as orchestration_fakes
        ]]

        failures = self.cmd._build_failed_resources('stack')
        expected = collections.OrderedDict()
        expected['stack.my_templateresource'] = self.failed_template_resource
        expected['stack.my_othertemplateresource'] = (
            self.other_failed_template_resource)
        self.assertEqual(expected, failures)

    def test_build_software_deployments(self):
        resources = {
            'stack.my_server': self.working_resource,
            'stack.my_deployment': self.failed_deployment_resource
        }
        deployments = self.cmd._build_software_deployments(resources)
        self.assertEqual({
            'eeee': self.failed_deployment
        }, deployments)

    def test_build_software_deployments_not_found(self):
        resources = {
            'stack.my_server': self.working_resource,
            'stack.my_deployment': self.failed_deployment_resource
        }
        self.software_deployments_client.get.side_effect = exc.HTTPNotFound()
        deployments = self.cmd._build_software_deployments(resources)
        self.assertEqual({}, deployments)

    def test_build_software_deployments_no_resources(self):
        resources = {}

# Path: heatclient/exc.py
# class BaseException(Exception):
# class CommandError(BaseException):
# class InvalidEndpoint(BaseException):
# class CommunicationError(BaseException):
# class HTTPException(BaseException):
# class HTTPMultipleChoices(HTTPException):
# class BadRequest(HTTPException):
# class HTTPBadRequest(BadRequest):
# class Unauthorized(HTTPException):
# class HTTPUnauthorized(Unauthorized):
# class Forbidden(HTTPException):
# class HTTPForbidden(Forbidden):
# class NotFound(HTTPException):
# class HTTPNotFound(NotFound):
# class NoUniqueMatch(HTTPException):
# class HTTPMethodNotAllowed(HTTPException):
# class Conflict(HTTPException):
# class HTTPConflict(Conflict):
# class OverLimit(HTTPException):
# class HTTPOverLimit(OverLimit):
# class HTTPUnsupported(HTTPException):
# class HTTPInternalServerError(HTTPException):
# class HTTPNotImplemented(HTTPException):
# class HTTPBadGateway(HTTPException):
# class ServiceUnavailable(HTTPException):
# class HTTPServiceUnavailable(ServiceUnavailable):
# class NoTokenLookupException(Exception):
# class EndpointNotFound(Exception):
# class StackFailure(Exception):
#     def __init__(self, message=None):
#     def __str__(self):
#     def __init__(self, message=None, code=None):
#     def __str__(self):
#     def __str__(self):
# def from_response(response):
# 
# Path: heatclient/osc/v1/stack_failures.py
# class ListStackFailures(command.Command):
#     def take_action(self, parsed_args):
#     def get_parser(self, prog_name):
#     def _build_failed_resources(self, stack):
#     def _append_failed_resources(self, failures, resources, resource_path):
#     def _build_software_deployments(self, resources):
#     def _print_failures(self, failures, deployment_failures, long=False):
# 
# Path: heatclient/tests/unit/osc/v1/fakes.py
# class TestOrchestrationv1(utils.TestCommand):
#     def setUp(self):


# Path: heatclient/tests/unit/osc/v1/test_stack_failures.py
import collections
from unittest import mock
from heatclient import exc
from heatclient.osc.v1 import stack_failures
from heatclient.tests.unit.osc.v1 import fakes as orchestration_fakes

        ]]

        failures = self.cmd._build_failed_resources('stack')
        expected = collections.OrderedDict()
        expected['stack.my_templateresource'] = self.failed_template_resource
        expected['stack.my_othertemplateresource'] = (
            self.other_failed_template_resource)
        self.assertEqual(expected, failures)

    def test_build_software_deployments(self):
        resources = {
            'stack.my_server': self.working_resource,
            'stack.my_deployment': self.failed_deployment_resource
        }
        deployments = self.cmd._build_software_deployments(resources)
        self.assertEqual({
            'eeee': self.failed_deployment
        }, deployments)

    def test_build_software_deployments_not_found(self):
        resources = {
            'stack.my_server': self.working_resource,
            'stack.my_deployment': self.failed_deployment_resource
        }
        self.software_deployments_client.get.side_effect = exc.HTTPNotFound()
        deployments = self.cmd._build_software_deployments(resources)
        self.assertEqual({}, deployments)

    def test_build_software_deployments_no_resources(self):
        resources = {}

        self.software_deployments_client.get.side_effect = exc.HTTPNotFound()