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


Python Event.delete方法代码示例

本文整理汇总了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()
开发者ID:40a,项目名称:openduty,代码行数:60,代码来源:test_events.py

示例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()
开发者ID:40a,项目名称:openduty,代码行数:15,代码来源:test_escalation_helper.py

示例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()
开发者ID:40a,项目名称:openduty,代码行数:16,代码来源:test_escalation_helper.py


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