# Path: monasca_api/v2/reference/notifications.py
# LOG = log.getLogger(__name__)
# class Notifications(notifications_api_v2.NotificationsV2API):
#     def __init__(self):
#     def _parse_and_validate_notification(self, notification, require_all=False):
#     def _validate_name_not_conflicting(self, tenant_id, name, expected_id=None):
#     def _validate_notification_method_type_exist(self, nmt):
#     def _create_notification(self, tenant_id, notification, uri):
#     def _update_notification(self, notification_id, tenant_id, notification, uri):
#     def _create_notification_response(self, id, name, type,
#                                       address, period, uri):
#     def _list_notifications(self, tenant_id, uri, sort_by, offset, limit):
#     def _list_notification(self, tenant_id, notification_id, uri):
#     def _build_notification_result(self, notification_row, uri):
#     def _delete_notification(self, tenant_id, notification_id):
#     def _patch_get_notification(self, tenant_id, notification_id, notification):
#     def on_post(self, req, res):
#     def on_get(self, req, res, notification_method_id=None):
#     def on_delete(self, req, res, notification_method_id):
#     def on_put(self, req, res, notification_method_id):
#     def on_patch(self, req, res, notification_method_id):


import datetime
import json
import falcon.testing
import fixtures
from oslo_config import cfg
from monasca_api.tests import base
from monasca_api.v2.reference import notifications
from monasca_api.v2.reference import notificationstype
    def test_list_notifications(self):
        expected_elements = \
            {'elements': [
                {'name': u'notification',
                 'id': u'1',
                 'type': u'EMAIL',
                 'period': 0,
                 'address': u'a@b.com',
                 'links': [{
                     'href': 'http://falconframework.org/v2.0/notification-methods/1',
                     'rel': 'self'}]}]}

        return_value = self.notifications_repo_mock.return_value
        return_value.list_notifications.return_value = \
            [{'name': u'notification',
              'id': u'1',
              'tenant_id': u'4199b031d5fa401abf9afaf7e58890b7',
              'type': u'EMAIL',
              'period': 0,
              'address': u'a@b.com',
              'created_at': datetime.datetime(2019, 3, 22, 9, 35, 25),
              'updated_at': datetime.datetime(2019, 3, 22, 9, 35, 25)}]
        response = self.simulate_request(path='/v2.0/notification-methods',
                                         headers={'X-Roles':
                                                  CONF.security.default_authorized_roles[0],
                                                  'X-Tenant-Id': TENANT_ID},
                                         method='GET')
        self.assertEqual(falcon.HTTP_200, response.status)
        self.assertThat(response, base.RESTResponseEquals(expected_elements))


# Path: monasca_api/v2/reference/notifications.py
# LOG = log.getLogger(__name__)
# class Notifications(notifications_api_v2.NotificationsV2API):
#     def __init__(self):
#     def _parse_and_validate_notification(self, notification, require_all=False):
#     def _validate_name_not_conflicting(self, tenant_id, name, expected_id=None):
#     def _validate_notification_method_type_exist(self, nmt):
#     def _create_notification(self, tenant_id, notification, uri):
#     def _update_notification(self, notification_id, tenant_id, notification, uri):
#     def _create_notification_response(self, id, name, type,
#                                       address, period, uri):
#     def _list_notifications(self, tenant_id, uri, sort_by, offset, limit):
#     def _list_notification(self, tenant_id, notification_id, uri):
#     def _build_notification_result(self, notification_row, uri):
#     def _delete_notification(self, tenant_id, notification_id):
#     def _patch_get_notification(self, tenant_id, notification_id, notification):
#     def on_post(self, req, res):
#     def on_get(self, req, res, notification_method_id=None):
#     def on_delete(self, req, res, notification_method_id):
#     def on_put(self, req, res, notification_method_id):
#     def on_patch(self, req, res, notification_method_id):


# Path: monasca_api/tests/test_notifications.py
import datetime
import json
import falcon.testing
import fixtures
from oslo_config import cfg
from monasca_api.tests import base
from monasca_api.v2.reference import notifications
from monasca_api.v2.reference import notificationstype

    def test_list_notifications(self):
        expected_elements = \
            {'elements': [
                {'name': u'notification',
                 'id': u'1',
                 'type': u'EMAIL',
                 'period': 0,
                 'address': u'a@b.com',
                 'links': [{
                     'href': 'http://falconframework.org/v2.0/notification-methods/1',
                     'rel': 'self'}]}]}

        return_value = self.notifications_repo_mock.return_value
        return_value.list_notifications.return_value = \
            [{'name': u'notification',
              'id': u'1',
              'tenant_id': u'4199b031d5fa401abf9afaf7e58890b7',
              'type': u'EMAIL',
              'period': 0,
              'address': u'a@b.com',
              'created_at': datetime.datetime(2019, 3, 22, 9, 35, 25),
              'updated_at': datetime.datetime(2019, 3, 22, 9, 35, 25)}]
        response = self.simulate_request(path='/v2.0/notification-methods',
                                         headers={'X-Roles':
                                                  CONF.security.default_authorized_roles[0],
                                                  'X-Tenant-Id': TENANT_ID},
                                         method='GET')
        self.assertEqual(falcon.HTTP_200, response.status)
        self.assertThat(response, base.RESTResponseEquals(expected_elements))


    def test_list_notifications_with_sort_by(self):