本文整理汇总了Python中test_factory.Factory.completed_volunteer_shift方法的典型用法代码示例。如果您正苦于以下问题:Python Factory.completed_volunteer_shift方法的具体用法?Python Factory.completed_volunteer_shift怎么用?Python Factory.completed_volunteer_shift使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test_factory.Factory
的用法示例。
在下文中一共展示了Factory.completed_volunteer_shift方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_queryset_for_new_group_rule_for_last_volunteer_shift_is_on
# 需要导入模块: from test_factory import Factory [as 别名]
# 或者: from test_factory.Factory import completed_volunteer_shift [as 别名]
def test_queryset_for_new_group_rule_for_last_volunteer_shift_is_on(self):
# create a new group rule (and TagSet)
group, group_rule = self.test_create_new_group_rule_for_last_volunteer_shift_is_on()
# hand-create a few people, some of whom match, and others who don't
ppl = self._generate_people()
target_date = datetime.date(month=3,day=24,year=2010)
Factory.completed_volunteer_shift(ppl[2], date=target_date)
Factory.completed_volunteer_shift(ppl[4], date=target_date)
# assert the queryset string is right
self.assertEqual(group_rule.queryset_filter_string, "filter(volunteer__completedshift__date=datetime.date(month=3,day=24,year=2010))")
# get the queryset, make sure it matches a hand-created one.
qs = group.members
hand_qs = Person.objects_by_account(self.account).filter(Q(pk=ppl[2].pk) | Q(pk=ppl[4].pk) )
self.assertEqualQuerySets(qs,hand_qs)
示例2: test_challenge_has_logged_volunteer_hours
# 需要导入模块: from test_factory import Factory [as 别名]
# 或者: from test_factory.Factory import completed_volunteer_shift [as 别名]
def test_challenge_has_logged_volunteer_hours(self):
p = Factory.person(self.a1)
Factory.completed_volunteer_shift(p)
self.a1.check_challenge_progress()
assert self.a1.challenge_has_logged_volunteer_hours == True