# Path: monitoring/alarms/constants.py
# URL_PREFIX = 'horizon:monitoring:alarms:'
# TEMPLATE_PREFIX = 'monitoring/alarms/'
# CRITICAL_ICON = prefix + 'monitoring/img/critical-icon.png'
# WARNING_ICON = prefix + 'monitoring/img/warning-icon.png'
# OK_ICON = prefix + 'monitoring/img/ok-icon.png'
# UNKNOWN_ICON = prefix + 'monitoring/img/unknown-icon.png'
# NOTFOUND_ICON = prefix + 'monitoring/img/notfound-icon.png'
# 
# Path: monitoring/alarms/tables.py
# STATUS = ["OK", "WARNING", "CRITICAL", "UNKNOWN"]
# def get_status(index):
# def show_status(data):
# def show_severity(data):
# def show_alarm_id(data):
# def show_metric_names(data):
# def show_def_name(data):
# def show_def_severity(data):
# def show_metric_dimensions(data):
# def get_service(data):
#     def get_link_url(self, datum):
#     def allowed(self, request, datum=None):
#     def get_link_url(self):
#     def allowed(self, request, datum=None):
#     def get_link_url(self, datum):
#     def allowed(self, request, datum=None):
#     def render(self):
#     def get_link_url(self, datum):
#     def allowed(self, request, datum=None):
#     def get_link_url(self, datum=None):
#     def action_present(count):
#     def action_past(count):
#     def allowed(self, request, datum=None):
#     def delete(self, request, obj_id):
#     def get_link_url(self):
#     def allowed(self, request, datum=None):
#     def get_object_id(self, obj):
#     def get_object_display(self, obj):
# def show_timestamp(data):
#     def get_object_id(self, obj):
# class ShowAlarmHistory(tables.LinkAction):
# class CreateAlarm(tables.LinkAction):
# class EditAlarm(tables.LinkAction):
# class GraphMetric(tables.LinkAction):
# class ShowAlarmDefinition(tables.LinkAction):
# class DeleteAlarm(tables.DeleteAction):
# class AlarmsFilterAction(tables.LinkAction):
# class AlarmsTable(tables.DataTable):
#     class Meta(object):
# class AlarmHistoryTable(tables.DataTable):
#     class Meta(object):
# 
# Path: monitoring/test/helpers.py
# class MonitoringTestsMixin(object):
# class TestCase(MonitoringTestsMixin, helpers.TestCase):
# class BaseAdminViewTests(MonitoringTestsMixin, helpers.BaseAdminViewTests):
# class APITestCase(MonitoringTestsMixin, helpers.APITestCase):
#     def _setup_test_data(self):


from django.urls import reverse
from unittest.mock import patch
from monitoring.alarms import constants
from monitoring.alarms import tables
from monitoring.test import helpers
            res = self.client.get(ALARMS_URL_BY_DIMENSION)
            self.assertEqual(mock.alarm_list_by_dimension.call_count, 2)

        self.assertTemplateUsed(
            res, 'monitoring/alarms/alarm.html')

    def test_alarms_get(self):
        with patch('monitoring.api.monitor', **{
            'spec_set': ['alarm_list'],
            'alarm_list.return_value': [],
        }) as mock:
            res = self.client.get(ALARMS_URL)
            self.assertEqual(mock.alarm_list.call_count, 2)

        self.assertTemplateUsed(
            res, 'monitoring/alarms/alarm.html')

    def test_metric_conversion_single(self):
        res = tables.show_metric_names({"metrics": [{"name": "mem.used_bytes"}]})
        self.assertEqual(res, "mem.used_bytes")

    def test_metric_conversion_multiple(self):
        res = tables.show_metric_names({"metrics": [{"name": "mem.used_bytes"},
                                                    {"name": "mem.total_bytes"}]})
        table_res = res.split(', ')
        self.assertEqual(len(table_res), 2)
        self.assertTrue("mem.used_bytes" in table_res)
        self.assertTrue("mem.total_bytes" in table_res)

    def test_metric_conversion_unique(self):

# Path: monitoring/alarms/constants.py
# URL_PREFIX = 'horizon:monitoring:alarms:'
# TEMPLATE_PREFIX = 'monitoring/alarms/'
# CRITICAL_ICON = prefix + 'monitoring/img/critical-icon.png'
# WARNING_ICON = prefix + 'monitoring/img/warning-icon.png'
# OK_ICON = prefix + 'monitoring/img/ok-icon.png'
# UNKNOWN_ICON = prefix + 'monitoring/img/unknown-icon.png'
# NOTFOUND_ICON = prefix + 'monitoring/img/notfound-icon.png'
# 
# Path: monitoring/alarms/tables.py
# STATUS = ["OK", "WARNING", "CRITICAL", "UNKNOWN"]
# def get_status(index):
# def show_status(data):
# def show_severity(data):
# def show_alarm_id(data):
# def show_metric_names(data):
# def show_def_name(data):
# def show_def_severity(data):
# def show_metric_dimensions(data):
# def get_service(data):
#     def get_link_url(self, datum):
#     def allowed(self, request, datum=None):
#     def get_link_url(self):
#     def allowed(self, request, datum=None):
#     def get_link_url(self, datum):
#     def allowed(self, request, datum=None):
#     def render(self):
#     def get_link_url(self, datum):
#     def allowed(self, request, datum=None):
#     def get_link_url(self, datum=None):
#     def action_present(count):
#     def action_past(count):
#     def allowed(self, request, datum=None):
#     def delete(self, request, obj_id):
#     def get_link_url(self):
#     def allowed(self, request, datum=None):
#     def get_object_id(self, obj):
#     def get_object_display(self, obj):
# def show_timestamp(data):
#     def get_object_id(self, obj):
# class ShowAlarmHistory(tables.LinkAction):
# class CreateAlarm(tables.LinkAction):
# class EditAlarm(tables.LinkAction):
# class GraphMetric(tables.LinkAction):
# class ShowAlarmDefinition(tables.LinkAction):
# class DeleteAlarm(tables.DeleteAction):
# class AlarmsFilterAction(tables.LinkAction):
# class AlarmsTable(tables.DataTable):
#     class Meta(object):
# class AlarmHistoryTable(tables.DataTable):
#     class Meta(object):
# 
# Path: monitoring/test/helpers.py
# class MonitoringTestsMixin(object):
# class TestCase(MonitoringTestsMixin, helpers.TestCase):
# class BaseAdminViewTests(MonitoringTestsMixin, helpers.BaseAdminViewTests):
# class APITestCase(MonitoringTestsMixin, helpers.APITestCase):
#     def _setup_test_data(self):


# Path: monitoring/alarms/tests.py
from django.urls import reverse
from unittest.mock import patch
from monitoring.alarms import constants
from monitoring.alarms import tables
from monitoring.test import helpers

            res = self.client.get(ALARMS_URL_BY_DIMENSION)
            self.assertEqual(mock.alarm_list_by_dimension.call_count, 2)

        self.assertTemplateUsed(
            res, 'monitoring/alarms/alarm.html')

    def test_alarms_get(self):
        with patch('monitoring.api.monitor', **{
            'spec_set': ['alarm_list'],
            'alarm_list.return_value': [],
        }) as mock:
            res = self.client.get(ALARMS_URL)
            self.assertEqual(mock.alarm_list.call_count, 2)

        self.assertTemplateUsed(
            res, 'monitoring/alarms/alarm.html')

    def test_metric_conversion_single(self):
        res = tables.show_metric_names({"metrics": [{"name": "mem.used_bytes"}]})
        self.assertEqual(res, "mem.used_bytes")

    def test_metric_conversion_multiple(self):
        res = tables.show_metric_names({"metrics": [{"name": "mem.used_bytes"},
                                                    {"name": "mem.total_bytes"}]})
        table_res = res.split(', ')
        self.assertEqual(len(table_res), 2)
        self.assertTrue("mem.used_bytes" in table_res)
        self.assertTrue("mem.total_bytes" in table_res)

    def test_metric_conversion_unique(self):

        res = tables.show_metric_names({"metrics": [{"name": "mem.used_bytes"},