本文整理汇总了Python中app.App.update_participant方法的典型用法代码示例。如果您正苦于以下问题:Python App.update_participant方法的具体用法?Python App.update_participant怎么用?Python App.update_participant使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app.App
的用法示例。
在下文中一共展示了App.update_participant方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_participation_logic
# 需要导入模块: from app import App [as 别名]
# 或者: from app.App import update_participant [as 别名]
def test_participation_logic(self):
rep = self._register()
now = datetime.now()
participant = StudyParticipant.objects.create(
reporter=rep, start_date = now.date(),
notification_time=now.time(), state="0",
next_question_time=now, next_start_time=now)
app = App("")
participant = app.update_participant(participant)
self.assertEqual("1", participant.state)
date = now + timedelta(hours=1)
next_date = now + timedelta(days=7)
self.assertEqual(date, participant.next_question_time)
self.assertEqual(next_date, participant.next_start_time)
participant = app.update_participant(participant)
self.assertEqual("2", participant.state)
date = now + timedelta(days=1)
self.assertEqual(date, participant.next_question_time)
self.assertEqual(next_date, participant.next_start_time)
participant = app.update_participant(participant)
self.assertEqual("3", participant.state)
date = now + timedelta(days=2)
self.assertEqual(date, participant.next_question_time)
self.assertEqual(next_date, participant.next_start_time)
participant = app.update_participant(participant)
self.assertEqual("0", participant.state)
self.assertEqual(next_date, participant.next_question_time)
self.assertEqual(next_date, participant.next_start_time)