# Path: aodh/notifier/heat.py
# LOG = log.getLogger(__name__)
# class TrustHeatAlarmNotifier(notifier.AlarmNotifier):
#     def __init__(self, conf):
#     def notify(self, action, alarm_id, alarm_name, severity, previous, current,
#                reason, reason_data):
# 
# Path: aodh/tests/unit/notifier/base.py
# class TestNotifierBase(base.BaseTestCase):
#     def setUp(self):


from unittest import mock
from oslo_utils import netutils
from aodh.notifier import heat as heat_notifier
from aodh.tests.unit.notifier import base



class TestTrustHeatAlarmNotifier(base.TestNotifierBase):
    @mock.patch("aodh.keystone_client.get_heat_client_from_trust")
    def test_notify(self, mock_heatclient):
        action = netutils.urlsplit("trust+autohealer://fake_trust_id:delete@")
        alarm_id = "fake_alarm_id"
        alarm_name = "fake_alarm_name"
        severity = "low"
        previous = "ok"
        current = "alarm"
        reason = "no good reason"
        reason_data = {
            "stack_id": "fake_stack_id",
            "asg_id": "fake_asg_id",
            "unhealthy_members": [
                {"id": "3bd8bc5a-7632-11e9-84cd-00224d6b7bc1"}
            ]
        }

        class FakeResource(object):
            def __init__(self, resource_name):
                self.parent_resource = resource_name

        mock_client = mock_heatclient.return_value
        mock_client.resources.list.return_value = [
            FakeResource("fake_resource_name")
        ]


# Path: aodh/notifier/heat.py
# LOG = log.getLogger(__name__)
# class TrustHeatAlarmNotifier(notifier.AlarmNotifier):
#     def __init__(self, conf):
#     def notify(self, action, alarm_id, alarm_name, severity, previous, current,
#                reason, reason_data):
# 
# Path: aodh/tests/unit/notifier/base.py
# class TestNotifierBase(base.BaseTestCase):
#     def setUp(self):


# Path: aodh/tests/unit/notifier/test_heat.py
from unittest import mock
from oslo_utils import netutils
from aodh.notifier import heat as heat_notifier
from aodh.tests.unit.notifier import base




class TestTrustHeatAlarmNotifier(base.TestNotifierBase):
    @mock.patch("aodh.keystone_client.get_heat_client_from_trust")
    def test_notify(self, mock_heatclient):
        action = netutils.urlsplit("trust+autohealer://fake_trust_id:delete@")
        alarm_id = "fake_alarm_id"
        alarm_name = "fake_alarm_name"
        severity = "low"
        previous = "ok"
        current = "alarm"
        reason = "no good reason"
        reason_data = {
            "stack_id": "fake_stack_id",
            "asg_id": "fake_asg_id",
            "unhealthy_members": [
                {"id": "3bd8bc5a-7632-11e9-84cd-00224d6b7bc1"}
            ]
        }

        class FakeResource(object):
            def __init__(self, resource_name):
                self.parent_resource = resource_name

        mock_client = mock_heatclient.return_value
        mock_client.resources.list.return_value = [
            FakeResource("fake_resource_name")
        ]


        notifier = heat_notifier.TrustHeatAlarmNotifier(self.conf)