• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python helpers.create_notification函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中monasca_tempest_tests.tests.api.helpers.create_notification函数的典型用法代码示例。如果您正苦于以下问题:Python create_notification函数的具体用法?Python create_notification怎么用?Python create_notification使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了create_notification函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_list_notification_methods_multiple_sort_by

    def test_list_notification_methods_multiple_sort_by(self):
        notifications = [helpers.create_notification(
            name='notification sort by 01',
            type='EMAIL',
            address='[email protected]',
        ), helpers.create_notification(
            name='notification sort by 02',
            type='PAGERDUTY',
            address='[email protected]',
        ), helpers.create_notification(
            name='notification sort by 03',
            type='EMAIL',
            address='[email protected]',
        ), helpers.create_notification(
            name='notification sort by 04',
            type='EMAIL',
            address='[email protected]',
        )]
        for notification in notifications:
            resp, response_body = self.monasca_client.create_notifications(notification)
            notification['id'] = response_body['id']

        resp, response_body = self.monasca_client.list_notification_methods(
            '?sort_by=' + urlparse.quote('type asc,address desc,id'))
        self.assertEqual(200, resp.status)

        expected_order = [2, 0, 3, 1]

        for i, element in enumerate(response_body['elements']):
            self.assertEqual(notifications[expected_order[i]]['id'], element['id'])

        for element in response_body['elements']:
            self.monasca_client.delete_notification_method(element['id'])
开发者ID:guimaluf,项目名称:monasca-api,代码行数:33,代码来源:test_notification_methods.py


示例2: test_create_webhook_notification_method_with_invalid_period

 def test_create_webhook_notification_method_with_invalid_period(self):
     notification = helpers.create_notification(type='WEBHOOK',
                                                address='http://localhost/test01',
                                                period=10)
     self.assertRaises((exceptions.BadRequest, exceptions.UnprocessableEntity),
                       self.monasca_client.create_notifications,
                       notification)
开发者ID:guimaluf,项目名称:monasca-api,代码行数:7,代码来源:test_notification_methods.py


示例3: test_create_notification_method_with_address_exceeds_max_length

 def test_create_notification_method_with_address_exceeds_max_length(self):
     long_address = "x" * (
         constants.MAX_NOTIFICATION_METHOD_ADDRESS_LENGTH + 1)
     notification = helpers.create_notification(address=long_address)
     self.assertRaises(exceptions.UnprocessableEntity,
                       self.monasca_client.create_notifications,
                       notification)
开发者ID:achoi0330,项目名称:avos_test,代码行数:7,代码来源:test_notification_methods.py


示例4: test_create_pagerduty_notification_method_with_invalid_non_zero_period

 def test_create_pagerduty_notification_method_with_invalid_non_zero_period(self):
     notification = helpers.create_notification(type='PAGERDUTY',
                                                address='[email protected]',
                                                period=60)
     self.assertRaises((exceptions.BadRequest, exceptions.UnprocessableEntity),
                       self.monasca_client.create_notifications,
                       notification)
开发者ID:guimaluf,项目名称:monasca-api,代码行数:7,代码来源:test_notification_methods.py


示例5: test_create_notification_method

 def test_create_notification_method(self):
     notification = helpers.create_notification()
     resp, response_body = self.monasca_client.create_notifications(
         notification)
     self.assertEqual(201, resp.status)
     id = response_body['id']
     resp, response_body = self.monasca_client.\
         delete_notification_method(id)
     self.assertEqual(204, resp.status)
开发者ID:achoi0330,项目名称:avos_test,代码行数:9,代码来源:test_notification_methods.py


示例6: test_create_email_notification_method_with_mixed_case_type

    def test_create_email_notification_method_with_mixed_case_type(self):
        notification = helpers.create_notification(name='mixed case email notification',
                                                   type='EmAil')
        resp, response_body = self.monasca_client.create_notifications(
            notification)
        self.assertEqual(201, resp.status)
        id = response_body['id']

        resp, response_body = self.monasca_client.\
            delete_notification_method(id)
        self.assertEqual(204, resp.status)
开发者ID:jobrs,项目名称:monasca-api,代码行数:11,代码来源:test_notification_methods.py


示例7: test_create_notification_method_webhook_with_mixed_case_type

    def test_create_notification_method_webhook_with_mixed_case_type(self):
        notification = helpers.create_notification(type='webHooK',
                                                   address='http://mytest.test:4533')
        resp, response_body = self.monasca_client.create_notifications(
            notification)
        self.assertEqual(201, resp.status)
        id = response_body['id']

        resp, response_body = self.monasca_client.\
            delete_notification_method(id)
        self.assertEqual(204, resp.status)
开发者ID:jobrs,项目名称:monasca-api,代码行数:11,代码来源:test_notification_methods.py


示例8: test_get_notification_method_with_invalid_id

 def test_get_notification_method_with_invalid_id(self):
     notification = helpers.create_notification()
     resp, response_body = self.monasca_client.create_notifications(
         notification)
     self.assertEqual(201, resp.status)
     id = data_utils.rand_name()
     self.assertRaises(exceptions.NotFound,
                       self.monasca_client.get_notification_method,
                       id)
     resp, response_body = self.monasca_client.\
         delete_notification_method(response_body['id'])
     self.assertEqual(204, resp.status)
开发者ID:achoi0330,项目名称:avos_test,代码行数:12,代码来源:test_notification_methods.py


示例9: test_patch_notification_method_with_non_int_period

 def test_patch_notification_method_with_non_int_period(self):
     name = data_utils.rand_name('notification-')
     notification = helpers.create_notification(name=name)
     resp, response_body = self.monasca_client.create_notifications(
         notification)
     id = response_body['id']
     self.assertEqual(201, resp.status)
     self.assertRaises((exceptions.BadRequest, exceptions.UnprocessableEntity),
                       self.monasca_client.patch_notification_method, id, period='zero')
     resp, response_body = \
         self.monasca_client.delete_notification_method(id)
     self.assertEqual(204, resp.status)
开发者ID:guimaluf,项目名称:monasca-api,代码行数:12,代码来源:test_notification_methods.py


示例10: test_patch_notification_method_address_exceeds_max_length

 def test_patch_notification_method_address_exceeds_max_length(self):
     name = data_utils.rand_name('notification-')
     notification = helpers.create_notification(name=name)
     resp, response_body = self.monasca_client.create_notifications(
         notification)
     id = response_body['id']
     self.assertEqual(201, resp.status)
     new_address_long = "x" * (
         constants.MAX_NOTIFICATION_METHOD_ADDRESS_LENGTH + 1)
     self.assertRaises((exceptions.BadRequest, exceptions.UnprocessableEntity),
                       self.monasca_client.patch_notification_method, id, address=new_address_long)
     resp, response_body = \
         self.monasca_client.delete_notification_method(id)
     self.assertEqual(204, resp.status)
开发者ID:guimaluf,项目名称:monasca-api,代码行数:14,代码来源:test_notification_methods.py


示例11: test_update_notification_method_invalid_type

 def test_update_notification_method_invalid_type(self):
     name = data_utils.rand_name('notification-')
     notification = helpers.create_notification(name=name)
     resp, response_body = self.monasca_client.create_notifications(
         notification)
     id = response_body['id']
     self.assertEqual(201, resp.status)
     self.assertRaises(exceptions.BadRequest,
                       self.monasca_client.update_notification_method, id,
                       name=response_body['name'], type='random',
                       address=response_body['address'])
     resp, response_body = \
         self.monasca_client.delete_notification_method(id)
     self.assertEqual(204, resp.status)
开发者ID:achoi0330,项目名称:avos_test,代码行数:14,代码来源:test_notification_methods.py


示例12: test_create_notification_method_webhook_test_tld_and_port

    def test_create_notification_method_webhook_test_tld_and_port(self):
        name = data_utils.rand_name('notification-')
        notification = helpers.create_notification(name=name,
                                                   type='WEBHOOK',
                                                   address='http://mytest.test:4533/webhook',
                                                   period=60)
        resp, response_body = self.monasca_client.create_notifications(
            notification)
        self.assertEqual(201, resp.status)
        id = response_body['id']

        resp, response_body = self.monasca_client.\
            delete_notification_method(id)
        self.assertEqual(204, resp.status)
开发者ID:guimaluf,项目名称:monasca-api,代码行数:14,代码来源:test_notification_methods.py


示例13: test_create_webhook_notification_method_with_non_zero_period

    def test_create_webhook_notification_method_with_non_zero_period(self):
        name = data_utils.rand_name('notification-')
        notification = helpers.create_notification(name=name,
                                                   type='WEBHOOK',
                                                   address='http://localhost/test01',
                                                   period=60)
        resp, response_body = self.monasca_client.create_notifications(
            notification)
        self.assertEqual(201, resp.status)
        id = response_body['id']

        resp, response_body = self.monasca_client.\
            delete_notification_method(id)
        self.assertEqual(204, resp.status)
开发者ID:guimaluf,项目名称:monasca-api,代码行数:14,代码来源:test_notification_methods.py


示例14: test_update_email_notification_method_with_nonzero_period

 def test_update_email_notification_method_with_nonzero_period(self):
     name = data_utils.rand_name('notification-')
     notification = helpers.create_notification(name=name)
     resp, response_body = self.monasca_client.create_notifications(
         notification)
     id = response_body['id']
     self.assertEqual(201, resp.status)
     self.assertRaises((exceptions.BadRequest, exceptions.UnprocessableEntity),
                       self.monasca_client.update_notification_method, id,
                       name=response_body['name'], type=response_body['type'],
                       address=response_body['address'], period=60)
     resp, response_body = \
         self.monasca_client.delete_notification_method(id)
     self.assertEqual(204, resp.status)
开发者ID:guimaluf,项目名称:monasca-api,代码行数:14,代码来源:test_notification_methods.py


示例15: test_patch_webhook_notification_method_with_invalid_period

 def test_patch_webhook_notification_method_with_invalid_period(self):
     name = data_utils.rand_name('notification-')
     notification = helpers.create_notification(name=name,
                                                type='WEBHOOK',
                                                address='http://localhost/test01',
                                                period=60)
     resp, response_body = self.monasca_client.create_notifications(
         notification)
     id = response_body['id']
     self.assertEqual(201, resp.status)
     self.assertRaises((exceptions.BadRequest, exceptions.UnprocessableEntity),
                       self.monasca_client.patch_notification_method, id, period=5)
     resp, response_body = \
         self.monasca_client.delete_notification_method(id)
     self.assertEqual(204, resp.status)
开发者ID:guimaluf,项目名称:monasca-api,代码行数:15,代码来源:test_notification_methods.py


示例16: test_patch_notification_method_address

 def test_patch_notification_method_address(self):
     address = DEFAULT_EMAIL_ADDRESS
     notification = helpers.create_notification(address=address)
     resp, response_body = self.monasca_client.create_notifications(
         notification)
     self.assertEqual(201, resp.status)
     self.assertEqual(address, response_body['address'])
     id = response_body['id']
     new_address = '[email protected]'
     resp, response_body = self.monasca_client.\
         patch_notification_method(id, address=new_address)
     self.assertEqual(200, resp.status)
     self.assertEqual(new_address, response_body['address'])
     resp, response_body = \
         self.monasca_client.delete_notification_method(id)
     self.assertEqual(204, resp.status)
开发者ID:guimaluf,项目名称:monasca-api,代码行数:16,代码来源:test_notification_methods.py


示例17: test_patch_notification_method_name

 def test_patch_notification_method_name(self):
     name = data_utils.rand_name('notification-')
     notification = helpers.create_notification(name=name)
     resp, response_body = self.monasca_client.create_notifications(
         notification)
     self.assertEqual(201, resp.status)
     self.assertEqual(name, response_body['name'])
     id = response_body['id']
     new_name = name + 'update'
     resp, response_body = self.monasca_client.\
         patch_notification_method(id, new_name)
     self.assertEqual(200, resp.status)
     self.assertEqual(new_name, response_body['name'])
     resp, response_body = self.monasca_client.\
         delete_notification_method(id)
     self.assertEqual(204, resp.status)
开发者ID:guimaluf,项目名称:monasca-api,代码行数:16,代码来源:test_notification_methods.py


示例18: test_update_notification_method_name_exceeds_max_length

 def test_update_notification_method_name_exceeds_max_length(self):
     name = data_utils.rand_name('notification-')
     notification = helpers.create_notification(name=name)
     resp, response_body = self.monasca_client.create_notifications(
         notification)
     id = response_body['id']
     self.assertEqual(201, resp.status)
     new_name_long = "x" * (constants.MAX_NOTIFICATION_METHOD_NAME_LENGTH
                            + 1)
     self.assertRaises(exceptions.UnprocessableEntity,
                       self.monasca_client.update_notification_method, id,
                       name=new_name_long, type=response_body['type'],
                       address=response_body['address'])
     resp, response_body = \
         self.monasca_client.delete_notification_method(id)
     self.assertEqual(204, resp.status)
开发者ID:achoi0330,项目名称:avos_test,代码行数:16,代码来源:test_notification_methods.py


示例19: test_patch_notification_method_type

 def test_patch_notification_method_type(self):
     type = 'EMAIL'
     notification = helpers.create_notification(type=type)
     resp, response_body = self.monasca_client.create_notifications(
         notification)
     self.assertEqual(201, resp.status)
     self.assertEqual(type, response_body['type'])
     id = response_body['id']
     new_type = 'PAGERDUTY'
     resp, response_body = \
         self.monasca_client.\
         patch_notification_method(id, type=new_type)
     self.assertEqual(200, resp.status)
     self.assertEqual(new_type, response_body['type'])
     resp, response_body = self.monasca_client.\
         delete_notification_method(id)
     self.assertEqual(204, resp.status)
开发者ID:guimaluf,项目名称:monasca-api,代码行数:17,代码来源:test_notification_methods.py


示例20: test_update_webhook_notification_method_to_pagerduty_with_nonzero_period

 def test_update_webhook_notification_method_to_pagerduty_with_nonzero_period(self):
     name = data_utils.rand_name('notification-')
     notification = helpers.create_notification(name=name,
                                                type='WEBHOOK',
                                                address='http://localhost/test01',
                                                period=60)
     resp, response_body = self.monasca_client.create_notifications(
         notification)
     id = response_body['id']
     self.assertEqual(201, resp.status)
     self.assertRaises((exceptions.BadRequest, exceptions.UnprocessableEntity),
                       self.monasca_client.update_notification_method, id,
                       name=response_body['name'], type='PAGERDUTY',
                       address='[email protected]', period=response_body['period'])
     resp, response_body = \
         self.monasca_client.delete_notification_method(id)
     self.assertEqual(204, resp.status)
开发者ID:guimaluf,项目名称:monasca-api,代码行数:17,代码来源:test_notification_methods.py



注:本文中的monasca_tempest_tests.tests.api.helpers.create_notification函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python models.Repository类代码示例发布时间:2022-05-27
下一篇:
Python helpers.create_metric函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap