# 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/jira_notifier.py
# CONF = cfg.CONF
# class JiraNotifier(AbstractNotifier):
#     def __init__(self, log):
#     def config(self, config_dict):
#     def statsd_name(self):
#     def _get_jira_custom_format_fields(self):
#     def _build_custom_jira_message(self, notification, jira_fields_format):
#     def _build_default_jira_message(self, notification):
#     def _build_jira_message(self, notification):
#     def send_notification(self, notification):
#     def jira_workflow(self, jira_fields, jira_obj, 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):


from unittest import mock
from monasca_notification import notification as m_notification
from monasca_notification.plugins import jira_notifier
from tests import base
import queue
                                                        TestJira.default_address)
        self.assertTrue(result)
        mock_jira_obj.create_issue.assert_not_called()
        mock_jira_obj.transition_issue.assert_not_called()

    def test_send_notification_without_issue_list(self):
        issue_status = None
        mock_jira, mock_jira_obj, result = self._notify(TestJira.default_transitions_value,
                                                        issue_status,
                                                        TestJira.default_address)
        self.assertTrue(result)
        mock_jira_obj.transitions.assert_not_called()
        self.assertEqual(issue(), mock_jira_obj.create_issue.call_args[1])

    def test_send_notification_without_componet(self):
        issue_status = None
        address = 'http://test.jira:3333/?project=MyProject'
        mock_jira, mock_jira_obj, result = self._notify(TestJira.default_transitions_value,
                                                        issue_status,
                                                        address)
        self.assertTrue(result)
        self.assertEqual(issue(component=False), mock_jira_obj.create_issue.call_args[1])
        mock_jira_obj.transitions.assert_not_called()

    def test_send_notification_create_jira_object_args(self):
        mock_jira, mock_jira_obj, result = self._notify(TestJira.default_transitions_value,
                                                        TestJira.issue_status_resolved,
                                                        TestJira.default_address)
        self.assertEqual('http://test.jira:3333/', mock_jira.JIRA.call_args[0][0])
        self.assertEqual(('username', 'password'), mock_jira.JIRA.call_args[1].get('basic_auth'))

# 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/jira_notifier.py
# CONF = cfg.CONF
# class JiraNotifier(AbstractNotifier):
#     def __init__(self, log):
#     def config(self, config_dict):
#     def statsd_name(self):
#     def _get_jira_custom_format_fields(self):
#     def _build_custom_jira_message(self, notification, jira_fields_format):
#     def _build_default_jira_message(self, notification):
#     def _build_jira_message(self, notification):
#     def send_notification(self, notification):
#     def jira_workflow(self, jira_fields, jira_obj, 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_jira_notification.py
from unittest import mock
from monasca_notification import notification as m_notification
from monasca_notification.plugins import jira_notifier
from tests import base
import queue

                                                        TestJira.default_address)
        self.assertTrue(result)
        mock_jira_obj.create_issue.assert_not_called()
        mock_jira_obj.transition_issue.assert_not_called()

    def test_send_notification_without_issue_list(self):
        issue_status = None
        mock_jira, mock_jira_obj, result = self._notify(TestJira.default_transitions_value,
                                                        issue_status,
                                                        TestJira.default_address)
        self.assertTrue(result)
        mock_jira_obj.transitions.assert_not_called()
        self.assertEqual(issue(), mock_jira_obj.create_issue.call_args[1])

    def test_send_notification_without_componet(self):
        issue_status = None
        address = 'http://test.jira:3333/?project=MyProject'
        mock_jira, mock_jira_obj, result = self._notify(TestJira.default_transitions_value,
                                                        issue_status,
                                                        address)
        self.assertTrue(result)
        self.assertEqual(issue(component=False), mock_jira_obj.create_issue.call_args[1])
        mock_jira_obj.transitions.assert_not_called()

    def test_send_notification_create_jira_object_args(self):
        mock_jira, mock_jira_obj, result = self._notify(TestJira.default_transitions_value,
                                                        TestJira.issue_status_resolved,
                                                        TestJira.default_address)
        self.assertEqual('http://test.jira:3333/', mock_jira.JIRA.call_args[0][0])
        self.assertEqual(('username', 'password'), mock_jira.JIRA.call_args[1].get('basic_auth'))

        self.assertEqual(None, mock_jira.JIRA.call_args[1].get('proxies'))