本文整理汇总了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)
示例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)