当前位置: 首页>>代码示例>>Python>>正文


Python OpenEdXInstanceFactory.disable_monitoring方法代码示例

本文整理汇总了Python中instance.tests.models.factories.openedx_instance.OpenEdXInstanceFactory.disable_monitoring方法的典型用法代码示例。如果您正苦于以下问题:Python OpenEdXInstanceFactory.disable_monitoring方法的具体用法?Python OpenEdXInstanceFactory.disable_monitoring怎么用?Python OpenEdXInstanceFactory.disable_monitoring使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在instance.tests.models.factories.openedx_instance.OpenEdXInstanceFactory的用法示例。


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

示例1: test_disable_monitoring

# 需要导入模块: from instance.tests.models.factories.openedx_instance import OpenEdXInstanceFactory [as 别名]
# 或者: from instance.tests.models.factories.openedx_instance.OpenEdXInstanceFactory import disable_monitoring [as 别名]
 def test_disable_monitoring(self, mock_newrelic):  # pylint: disable=no-self-use
     """
     Check that the `disable_monitoring` method removes any New Relic
     Synthetics monitors for this instance.
     """
     monitor_ids = [str(uuid4()) for i in range(3)]
     instance = OpenEdXInstanceFactory()
     for monitor_id in monitor_ids:
         instance.new_relic_availability_monitors.create(pk=monitor_id)
     instance.disable_monitoring()
     mock_newrelic.delete_synthetics_monitor.assert_has_calls([
         call(monitor_id) for monitor_id in monitor_ids
     ], any_order=True)
开发者ID:open-craft,项目名称:opencraft,代码行数:15,代码来源:test_openedx_monitoring_mixins.py

示例2: test_disable_monitoring_monitors_not_found

# 需要导入模块: from instance.tests.models.factories.openedx_instance import OpenEdXInstanceFactory [as 别名]
# 或者: from instance.tests.models.factories.openedx_instance.OpenEdXInstanceFactory import disable_monitoring [as 别名]
    def test_disable_monitoring_monitors_not_found(self):
        """
        Test that the `disable_monitoring` method removes any New Relic
        Synthetics monitors for this instance, even if the actual monitors no longer exist.
        """
        monitor_ids = [str(uuid4()) for i in range(3)]
        instance = OpenEdXInstanceFactory()

        for monitor_id in monitor_ids:
            instance.new_relic_availability_monitors.create(pk=monitor_id)
            responses.add(
                responses.DELETE,
                '{0}/monitors/{1}'.format(newrelic.SYNTHETICS_API_URL, monitor_id),
                status=requests.codes.not_found  # pylint: disable=no-member
            )

        # Precondition
        self.assertEqual(instance.new_relic_availability_monitors.count(), 3)

        # Disable monitoring
        instance.disable_monitoring()

        # Instance should no longer have any monitors associated with it
        self.assertEqual(instance.new_relic_availability_monitors.count(), 0)
开发者ID:open-craft,项目名称:opencraft,代码行数:26,代码来源:test_openedx_monitoring_mixins.py


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