本文整理匯總了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