本文整理汇总了Python中bluebottle.test.factory_models.orders.OrderFactory.locked方法的典型用法代码示例。如果您正苦于以下问题:Python OrderFactory.locked方法的具体用法?Python OrderFactory.locked怎么用?Python OrderFactory.locked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bluebottle.test.factory_models.orders.OrderFactory
的用法示例。
在下文中一共展示了OrderFactory.locked方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setUp
# 需要导入模块: from bluebottle.test.factory_models.orders import OrderFactory [as 别名]
# 或者: from bluebottle.test.factory_models.orders.OrderFactory import locked [as 别名]
def setUp(self):
self.init_projects()
self.phase_campaign = ProjectPhase.objects.get(slug='campaign')
self.country = CountryFactory()
self.projects = []
for amount in [500, 100, 1500, 300, 200]:
self.projects.append(OnePercentProjectFactory.create(amount_asked=amount, status=self.phase_campaign))
# Some donations to get the popularity going
# Top 3 after this should be projects 4, 3, 0
order = OrderFactory()
DonationFactory(order=order, project=self.projects[3], amount=10)
DonationFactory(order=order, project=self.projects[3], amount=100)
DonationFactory(order=order, project=self.projects[3], amount=20)
DonationFactory(order=order, project=self.projects[4], amount=10)
DonationFactory(order=order, project=self.projects[4], amount=70)
DonationFactory(order=order, project=self.projects[0], amount=10)
order.locked()
order.succeeded()
# Since we force the transitions update_amounts isn't triggered by signal, so we run it manually here.
for project in self.projects:
project.update_amounts()
self.user1 = BlueBottleUserFactory.create()
self.user2 = BlueBottleUserFactory.create()
示例2: setUp
# 需要导入模块: from bluebottle.test.factory_models.orders import OrderFactory [as 别名]
# 或者: from bluebottle.test.factory_models.orders.OrderFactory import locked [as 别名]
def setUp(self):
super(MonthlyDonationAdminTest, self).setUp()
self.app.extra_environ['HTTP_HOST'] = str(self.tenant.domain_url)
self.superuser = BlueBottleUserFactory.create(is_staff=True, is_superuser=True)
self.init_projects()
self.phase_campaign = ProjectPhase.objects.get(slug='campaign')
self.country = CountryFactory()
self.projects = []
for amount in [500, 100, 1500, 300, 200]:
self.projects.append(
ProjectFactory.create(amount_asked=amount,
status=self.phase_campaign))
# Some donations to get the popularity going
# Top 3 after this should be projects 4, 3, 0
order = OrderFactory()
DonationFactory(order=order, project=self.projects[3], amount=10)
DonationFactory(order=order, project=self.projects[3], amount=100)
DonationFactory(order=order, project=self.projects[3], amount=20)
DonationFactory(order=order, project=self.projects[4], amount=10)
DonationFactory(order=order, project=self.projects[4], amount=70)
DonationFactory(order=order, project=self.projects[0], amount=10)
order.locked()
order.save()
order.success()
order.save()
# Since we force the transitions update_amounts isn't triggered by
# signal, so we run it manually here.
for project in self.projects:
project.update_amounts()
self.user1 = BlueBottleUserFactory.create()
self.user2 = BlueBottleUserFactory.create()
# Create a monthly donor with a preferred project
self.monthly_donor1 = MonthlyDonorFactory(user=self.user1, amount=25)
self.monthly_donor1_project = MonthlyDonorProjectFactory(
donor=self.monthly_donor1, project=self.projects[0])
# Create a monthly donor without preferred projects
self.monthly_donor2 = MonthlyDonorFactory(user=self.user2, amount=100)
Project.update_popularity()