# Path: monasca_notification/notification.py
# class Notification(object):
#     def __init__(self, id, type, name, address, period, retry_count, alarm):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def to_json(self):
# 
# Path: monasca_notification/plugins/email_notifier.py
# CONF = cfg.CONF
# EMAIL_SINGLE_HOST_BASE = u'''On host "{hostname}" for target "{target_host}" {message}
# 
# Alarm "{alarm_name}" transitioned to the {state} state at {timestamp} UTC
# alarm_id: {alarm_id}
# 
# Lifecycle state: {lifecycle_state}
# Link: {link}
# Link to Grafana: {grafana_url}
# 
# With dimensions:
# {metric_dimensions}'''
# EMAIL_MULTIPLE_HOST_BASE = u'''On host "{hostname}" {message}
# 
# Alarm "{alarm_name}" transitioned to the {state} state at {timestamp} UTC
# alarm_id: {alarm_id}
# 
# Lifecycle state: {lifecycle_state}
# Link: {link}
# Link to Grafana: {grafana_url}
# 
# With dimensions:
# {metric_dimensions}'''
# EMAIL_NO_HOST_BASE = u'''On multiple hosts {message}
# 
# Alarm "{alarm_name}" transitioned to the {state} state at {timestamp} UTC
# Alarm_id: {alarm_id}
# 
# Lifecycle state: {lifecycle_state}
# Link: {link}
# Link to Grafana: {grafana_url}
# 
# With dimensions
# {metric_dimensions}'''
# class EmailNotifier(abstract_notifier.AbstractNotifier):
#     def __init__(self, log):
#     def config(self, config=None):
#     def statsd_name(self):
#     def send_notification(self, notification):
#     def _sendmail(self, notification, msg):
#     def _email_error(self, notification):
#     def _smtp_connect(self):
#     def _create_msg(self, hostname, notification, targethost=None):
#     def _get_link_url(self, metric, timestamp_ms):
# def _format_dimensions(notification):
# def register_opts(conf):
# def list_opts():
# 
# Path: monasca_notification/processors/notification_processor.py
# class NotificationProcessor(object):
#     def __init__(self):
#     def _remaining_plugin_types(self):
#     def insert_configured_plugins(self):
#     def send(self, notifications):
# 
# 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):


import time
from unittest import mock
from monasca_notification import notification as m_notification
from monasca_notification.plugins import email_notifier
from monasca_notification.processors import notification_processor as np
from tests import base
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests NotificationProcessor"""




class smtpStub(object):
    def __init__(self, log_queue):
        self.queue = log_queue

    def sendmail(self, from_addr, to_addr, msg):
        self.queue.put("%s %s %s" % (from_addr, to_addr, msg))


class requestsResponse(object):
    def __init__(self, status):
        self.status_code = status


class TestNotificationProcessor(base.BaseTestCase):

    def setUp(self):
        super(TestNotificationProcessor, self).setUp()
        self.trap = []


# Path: monasca_notification/notification.py
# class Notification(object):
#     def __init__(self, id, type, name, address, period, retry_count, alarm):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def to_json(self):
# 
# Path: monasca_notification/plugins/email_notifier.py
# CONF = cfg.CONF
# EMAIL_SINGLE_HOST_BASE = u'''On host "{hostname}" for target "{target_host}" {message}
# 
# Alarm "{alarm_name}" transitioned to the {state} state at {timestamp} UTC
# alarm_id: {alarm_id}
# 
# Lifecycle state: {lifecycle_state}
# Link: {link}
# Link to Grafana: {grafana_url}
# 
# With dimensions:
# {metric_dimensions}'''
# EMAIL_MULTIPLE_HOST_BASE = u'''On host "{hostname}" {message}
# 
# Alarm "{alarm_name}" transitioned to the {state} state at {timestamp} UTC
# alarm_id: {alarm_id}
# 
# Lifecycle state: {lifecycle_state}
# Link: {link}
# Link to Grafana: {grafana_url}
# 
# With dimensions:
# {metric_dimensions}'''
# EMAIL_NO_HOST_BASE = u'''On multiple hosts {message}
# 
# Alarm "{alarm_name}" transitioned to the {state} state at {timestamp} UTC
# Alarm_id: {alarm_id}
# 
# Lifecycle state: {lifecycle_state}
# Link: {link}
# Link to Grafana: {grafana_url}
# 
# With dimensions
# {metric_dimensions}'''
# class EmailNotifier(abstract_notifier.AbstractNotifier):
#     def __init__(self, log):
#     def config(self, config=None):
#     def statsd_name(self):
#     def send_notification(self, notification):
#     def _sendmail(self, notification, msg):
#     def _email_error(self, notification):
#     def _smtp_connect(self):
#     def _create_msg(self, hostname, notification, targethost=None):
#     def _get_link_url(self, metric, timestamp_ms):
# def _format_dimensions(notification):
# def register_opts(conf):
# def list_opts():
# 
# Path: monasca_notification/processors/notification_processor.py
# class NotificationProcessor(object):
#     def __init__(self):
#     def _remaining_plugin_types(self):
#     def insert_configured_plugins(self):
#     def send(self, notifications):
# 
# 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_notification_processor.py
import time
from unittest import mock
from monasca_notification import notification as m_notification
from monasca_notification.plugins import email_notifier
from monasca_notification.processors import notification_processor as np
from tests import base

# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

"""Tests NotificationProcessor"""




class smtpStub(object):
    def __init__(self, log_queue):
        self.queue = log_queue

    def sendmail(self, from_addr, to_addr, msg):
        self.queue.put("%s %s %s" % (from_addr, to_addr, msg))


class requestsResponse(object):
    def __init__(self, status):
        self.status_code = status


class TestNotificationProcessor(base.BaseTestCase):

    def setUp(self):
        super(TestNotificationProcessor, self).setUp()
        self.trap = []


        email_notifier.register_opts(base.config.CONF)