本文整理匯總了Python中test_factory.Factory.donation方法的典型用法代碼示例。如果您正苦於以下問題:Python Factory.donation方法的具體用法?Python Factory.donation怎麽用?Python Factory.donation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類test_factory.Factory
的用法示例。
在下文中一共展示了Factory.donation方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_queryset_for_new_group_rule_for_last_donation_is_after
# 需要導入模塊: from test_factory import Factory [as 別名]
# 或者: from test_factory.Factory import donation [as 別名]
def test_queryset_for_new_group_rule_for_last_donation_is_after(self):
# create a new group rule
group, group_rule = self.test_create_new_group_rule_for_last_donation_is_after()
# hand-create a few people, some of whom match, and others who don't
ppl = self._generate_people()
target_date = datetime.date(month=2,day=12,year=2009)
Factory.donation(ppl[1], date=target_date+datetime.timedelta(days=10))
Factory.donation(ppl[2], date=target_date)
Factory.donation(ppl[4], date=target_date-datetime.timedelta(days=59))
self.assertEqual(group_rule.queryset_filter_string, "filter(donor__donation__date__gt=datetime.date(month=2,day=12,year=2009))")
# 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[1].pk))
self.assertEqualQuerySets(qs,hand_qs)
# check the opposite
opposite_group, opposite_group_rule = self.test_create_new_group_rule_for_last_donation_is_after(operator_name="is before")
oppostite_hand_qs = Person.objects_by_account(self.account).filter(Q(pk=ppl[4].pk))
self.assertEqualQuerySets(opposite_group.members,oppostite_hand_qs)
示例2: test_challenge_has_added_a_donation
# 需要導入模塊: from test_factory import Factory [as 別名]
# 或者: from test_factory.Factory import donation [as 別名]
def test_challenge_has_added_a_donation(self):
Factory.donation(account=self.a1)
self.a1.check_challenge_progress()
assert self.a1.challenge_has_added_a_donation == True