# 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/slack_notifier.py
# CONF = cfg.CONF
#     MAX_CACHE_SIZE = 100
#     RESPONSE_OK = 'ok'
# class SlackNotifier(abstract_notifier.AbstractNotifier):
#     def __init__(self, log):
#     def config(self, config_dict):
#     def statsd_name(self):
#     def _build_slack_message(self, notification):
#     def _render_message_template(self, params):
#     def _check_response(self, result):
#     def _send_message(self, request_options):
#     def send_notification(self, notification):
# def register_opts(conf):
# def list_opts():
# 
# 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 json
import queue
from unittest import mock
from monasca_notification import notification as m_notification
from monasca_notification.plugins import slack_notifier
from tests import base
    def setUp(self):
        super(TestSlack, self).setUp(
            slack_notifier.register_opts
        )
        self.conf_default(group='slack_notifier', timeout=50,
                          ca_certs='/etc/ssl/certs/ca-bundle.crt',
                          proxy='http://yourid:password@proxyserver:8080',
                          insecure=False)

        self._trap = queue.Queue()

        mock_log = mock.Mock()
        mock_log.info = self._trap.put
        mock_log.warn = self._trap.put
        mock_log.error = self._trap.put
        mock_log.exception = self._trap.put

        self._slk = slack_notifier.SlackNotifier(mock_log)
        slack_notifier.SlackNotifier._raw_data_url_caches = []

    @mock.patch('monasca_notification.plugins.slack_notifier.requests')
    def _notify(self, response_list, mock_requests):
        mock_requests.post = mock.Mock(side_effect=response_list)

        metric = []
        metric_data = {'dimensions': {'hostname': 'foo1', 'service': 'bar1'}}
        metric.append(metric_data)

        alarm_dict = alarm(metric)


# 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/slack_notifier.py
# CONF = cfg.CONF
#     MAX_CACHE_SIZE = 100
#     RESPONSE_OK = 'ok'
# class SlackNotifier(abstract_notifier.AbstractNotifier):
#     def __init__(self, log):
#     def config(self, config_dict):
#     def statsd_name(self):
#     def _build_slack_message(self, notification):
#     def _render_message_template(self, params):
#     def _check_response(self, result):
#     def _send_message(self, request_options):
#     def send_notification(self, notification):
# def register_opts(conf):
# def list_opts():
# 
# 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_slack_notification.py
import json
import queue
from unittest import mock
from monasca_notification import notification as m_notification
from monasca_notification.plugins import slack_notifier
from tests import base

    def setUp(self):
        super(TestSlack, self).setUp(
            slack_notifier.register_opts
        )
        self.conf_default(group='slack_notifier', timeout=50,
                          ca_certs='/etc/ssl/certs/ca-bundle.crt',
                          proxy='http://yourid:password@proxyserver:8080',
                          insecure=False)

        self._trap = queue.Queue()

        mock_log = mock.Mock()
        mock_log.info = self._trap.put
        mock_log.warn = self._trap.put
        mock_log.error = self._trap.put
        mock_log.exception = self._trap.put

        self._slk = slack_notifier.SlackNotifier(mock_log)
        slack_notifier.SlackNotifier._raw_data_url_caches = []

    @mock.patch('monasca_notification.plugins.slack_notifier.requests')
    def _notify(self, response_list, mock_requests):
        mock_requests.post = mock.Mock(side_effect=response_list)

        metric = []
        metric_data = {'dimensions': {'hostname': 'foo1', 'service': 'bar1'}}
        metric.append(metric_data)

        alarm_dict = alarm(metric)


        notification = m_notification.Notification(0, 'slack', 'slack notification',