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


Python EmailConfirmation.date方法代码示例

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


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

示例1: test_patch_submitter_expiry

# 需要导入模块: from patchwork.models import EmailConfirmation [as 别名]
# 或者: from patchwork.models.EmailConfirmation import date [as 别名]
    def test_patch_submitter_expiry(self):
        # someone submits a patch...
        patch = create_patch()
        submitter = patch.submitter

        # ... then starts registration...
        date = ((datetime.datetime.utcnow() - EmailConfirmation.validity) -
                datetime.timedelta(hours=1))
        user = create_user(link_person=False, email=submitter.email)
        user.is_active = False
        user.date_joined = user.last_login = date
        user.save()

        conf = EmailConfirmation(type='registration', user=user,
                                 email=user.email)
        conf.date = date
        conf.save()

        # ... which expires
        expire_notifications()

        # we should see no matching user
        self.assertFalse(User.objects.filter(email=patch.submitter.email)
                         .exists())
        # but the patch and person should still be present
        self.assertTrue(Person.objects.filter(pk=submitter.pk).exists())
        self.assertTrue(Patch.objects.filter(pk=patch.pk).exists())
        # and there should be no user associated with the person
        self.assertEqual(Person.objects.get(pk=submitter.pk).user, None)
开发者ID:daxtens,项目名称:patchwork,代码行数:31,代码来源:test_expiry.py

示例2: register

# 需要导入模块: from patchwork.models import EmailConfirmation [as 别名]
# 或者: from patchwork.models.EmailConfirmation import date [as 别名]
    def register(self, date):
        user = create_user()
        user.is_active = False
        user.date_joined = user.last_login = date
        user.save()

        conf = EmailConfirmation(type="registration", user=user, email=user.email)
        conf.date = date
        conf.save()

        return (user, conf)
开发者ID:getpatchwork,项目名称:patchwork,代码行数:13,代码来源:test_expiry.py

示例3: testPatchSubmitterExpiry

# 需要导入模块: from patchwork.models import EmailConfirmation [as 别名]
# 或者: from patchwork.models.EmailConfirmation import date [as 别名]
    def testPatchSubmitterExpiry(self):
        defaults.project.save()
        defaults.patch_author_person.save()

        # someone submits a patch...
        patch = Patch(project=defaults.project,
                      msgid='[email protected]', name='test patch',
                      submitter=defaults.patch_author_person,
                      content=defaults.patch)
        patch.save()

        # ... then starts registration...
        date = ((datetime.datetime.now() - EmailConfirmation.validity) -
                datetime.timedelta(hours=1))
        userid = 'test-user'
        user = User.objects.create_user(
            userid,
            defaults.patch_author_person.email, userid)
        user.is_active = False
        user.date_joined = user.last_login = date
        user.save()

        self.assertEqual(user.email, patch.submitter.email)

        conf = EmailConfirmation(type='registration', user=user,
                                 email=user.email)
        conf.date = date
        conf.save()

        # ... which expires
        do_expiry()

        # we should see no matching user
        self.assertFalse(User.objects.filter(email=patch.submitter.email)
                         .exists())
        # but the patch and person should still be present
        self.assertTrue(Person.objects.filter(
            pk=defaults.patch_author_person.pk).exists())
        self.assertTrue(Patch.objects.filter(pk=patch.pk).exists())

        # and there should be no user associated with the person
        self.assertEqual(Person.objects.get(
            pk=defaults.patch_author_person.pk).user, None)
开发者ID:anderco,项目名称:patchwork,代码行数:45,代码来源:test_expiry.py


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