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)
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