# Path: monasca_notification/common/repositories/orm/orm_repo.py
# LOG = logging.getLogger(__name__)
# CONF = cfg.CONF
# class OrmRepo(object):
#     def __init__(self):
#     def fetch_notifications(self, alarm):
#     def get_alarm_current_state(self, alarm_id):
#     def fetch_notification_method_types(self):
#     def insert_notification_method_types(self, notification_types):
#     def get_notification(self, notification_id):
# 
# Path: tests/base.py
# class DisableStatsdFixture(fixtures.Fixture):
# class ConfigFixture(oo_cfg.Config):
# class BaseTestCase(oslotest_base.BaseTestCase):
# class PluginTestCase(BaseTestCase):
#     def setUp(self):
#     def __init__(self):
#     def setUp(self):
#     def _clean_config_loaded_flag():
#     def setUp(self):
#     def conf_override(**kw):
#     def conf_default(**kw):
#     def setUp(self, register_opts=None):


from unittest import mock
from monasca_notification.common.repositories.orm import orm_repo
from tests import base
                         self._rep.fetch_notifications(alarm))

        self.mock_conn.execute.assert_called_once()
        self.assertEqual(self._rep._orm_query,
                         self.mock_conn.execute.call_args_list[0][0][0])
        self.assertEqual({'alarm_definition_id': alarmdef_id,
                          'alarm_state': new_state},
                         self.mock_conn.execute.call_args_list[0][1])

    def test_get_alarm_current_state_success(self):
        alarm_id = 'alarm-123'
        alarm_state = 'alarm'
        self.mock_conn.execute.return_value.fetchone.return_value = [alarm_state]

        self.assertEqual(self._rep.get_alarm_current_state(alarm_id), alarm_state)

        self.mock_conn.execute.assert_called_once()
        self.assertEqual(self._rep._orm_get_alarm_state,
                         self.mock_conn.execute.call_args_list[0][0][0])
        self.assertEqual({'alarm_id': alarm_id},
                         self.mock_conn.execute.call_args_list[0][1])

    def test_fetch_notification_method_types_success(self):
        notification_methods = [('EMAIL',), ('WEBHOOK',)]
        self.mock_conn.execute.return_value.fetchall.return_value = notification_methods

        self.assertEqual(self._rep.fetch_notification_method_types(), ['EMAIL', 'WEBHOOK'])

        self.mock_conn.execute.assert_called_once()
        self.assertEqual(self._rep._orm_nmt_query,

# Path: monasca_notification/common/repositories/orm/orm_repo.py
# LOG = logging.getLogger(__name__)
# CONF = cfg.CONF
# class OrmRepo(object):
#     def __init__(self):
#     def fetch_notifications(self, alarm):
#     def get_alarm_current_state(self, alarm_id):
#     def fetch_notification_method_types(self):
#     def insert_notification_method_types(self, notification_types):
#     def get_notification(self, notification_id):
# 
# Path: tests/base.py
# class DisableStatsdFixture(fixtures.Fixture):
# class ConfigFixture(oo_cfg.Config):
# class BaseTestCase(oslotest_base.BaseTestCase):
# class PluginTestCase(BaseTestCase):
#     def setUp(self):
#     def __init__(self):
#     def setUp(self):
#     def _clean_config_loaded_flag():
#     def setUp(self):
#     def conf_override(**kw):
#     def conf_default(**kw):
#     def setUp(self, register_opts=None):


# Path: tests/test_orm_repo.py
from unittest import mock
from monasca_notification.common.repositories.orm import orm_repo
from tests import base

                         self._rep.fetch_notifications(alarm))

        self.mock_conn.execute.assert_called_once()
        self.assertEqual(self._rep._orm_query,
                         self.mock_conn.execute.call_args_list[0][0][0])
        self.assertEqual({'alarm_definition_id': alarmdef_id,
                          'alarm_state': new_state},
                         self.mock_conn.execute.call_args_list[0][1])

    def test_get_alarm_current_state_success(self):
        alarm_id = 'alarm-123'
        alarm_state = 'alarm'
        self.mock_conn.execute.return_value.fetchone.return_value = [alarm_state]

        self.assertEqual(self._rep.get_alarm_current_state(alarm_id), alarm_state)

        self.mock_conn.execute.assert_called_once()
        self.assertEqual(self._rep._orm_get_alarm_state,
                         self.mock_conn.execute.call_args_list[0][0][0])
        self.assertEqual({'alarm_id': alarm_id},
                         self.mock_conn.execute.call_args_list[0][1])

    def test_fetch_notification_method_types_success(self):
        notification_methods = [('EMAIL',), ('WEBHOOK',)]
        self.mock_conn.execute.return_value.fetchall.return_value = notification_methods

        self.assertEqual(self._rep.fetch_notification_method_types(), ['EMAIL', 'WEBHOOK'])

        self.mock_conn.execute.assert_called_once()
        self.assertEqual(self._rep._orm_nmt_query,

                         self.mock_conn.execute.call_args_list[0][0][0])