本文整理汇总了Python中schedule.models.Event.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Event.delete方法的具体用法?Python Event.delete怎么用?Python Event.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类schedule.models.Event
的用法示例。
在下文中一共展示了Event.delete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestEventViews
# 需要导入模块: from schedule.models import Event [as 别名]
# 或者: from schedule.models.Event import delete [as 别名]
class TestEventViews(LoggedInTestCase):
def setUp(self):
super(TestEventViews, self).setUp()
self.cal = Calendar(
name=random_string(),
slug=random_string(),
)
self.cal.save()
self.event = Event(
start=timezone.now(),
end=timezone.now() + timedelta(weeks=6),
title=random_string(),
calendar=self.cal,
)
self.event.save()
def tearDown(self):
super(TestEventViews, self).tearDown()
try:
self.cal.delete()
self.event.delete()
except:
pass
def test_event_can_be_recurring(self):
rule = Rule(
name=random_string(),
description=random_string(),
frequency='WEEKLY',
)
rule.save()
try:
url = reverse(
'openduty.events.create_or_edit_event',
kwargs = {
'calendar_slug': self.cal.slug,
'event_id': str(self.event.id),
},
)
response = self.client.post(
path = url,
data = {
"start_0": self.event.start.strftime('%Y-%m-%d'),
"start_1": "09:00",
"end_0": self.event.end.strftime('%Y-%m-%d'),
"end_1": "23:00",
"description": "desc",
"rule": str(rule.id),
"oncall": "foo",
"fallback": "bar",
},
)
self.assertEqual(302, response.status_code)
e = Event.objects.get(id=self.event.id)
self.assertEqual(rule, e.rule)
finally:
rule.delete()
示例2: test_get_escalation_fails_with_no_recurrence_after_event_end
# 需要导入模块: from schedule.models import Event [as 别名]
# 或者: from schedule.models.Event import delete [as 别名]
def test_get_escalation_fails_with_no_recurrence_after_event_end(self):
event = Event(
start = timezone.now() - timedelta(days=2),
end = timezone.now() - timedelta(days=1),
title = '{username},{username}'.format(username=self.username),
calendar = self.cal,
)
event.save()
try:
events = get_escalation_for_service(self.service)
self.assertEqual(0, len(events))
finally:
event.delete()
示例3: test_get_escalation_returns_empty_for_muted_services
# 需要导入模块: from schedule.models import Event [as 别名]
# 或者: from schedule.models.Event import delete [as 别名]
def test_get_escalation_returns_empty_for_muted_services(self):
event = Event(
start = timezone.now() - timedelta(days=1),
end = timezone.now() + timedelta(days=1),
title = '{username},{username}'.format(username=self.username),
calendar = self.cal,
)
event.save()
self.service.notifications_disabled = True
try:
events = get_escalation_for_service(self.service)
self.assertEqual(0, len(events))
finally:
event.delete()