當前位置: 首頁>>代碼示例>>Python>>正文


Python CONSUMER_FACTORY.create_consumers方法代碼示例

本文整理匯總了Python中consumer.factories.consumer_factory.CONSUMER_FACTORY.create_consumers方法的典型用法代碼示例。如果您正苦於以下問題:Python CONSUMER_FACTORY.create_consumers方法的具體用法?Python CONSUMER_FACTORY.create_consumers怎麽用?Python CONSUMER_FACTORY.create_consumers使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在consumer.factories.consumer_factory.CONSUMER_FACTORY的用法示例。


在下文中一共展示了CONSUMER_FACTORY.create_consumers方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_valid_ad_rep

# 需要導入模塊: from consumer.factories.consumer_factory import CONSUMER_FACTORY [as 別名]
# 或者: from consumer.factories.consumer_factory.CONSUMER_FACTORY import create_consumers [as 別名]
 def test_valid_ad_rep(self):
     """ Assert view displays downline consumer and qualified consumer counts
     for each.
     """
     child_ad_rep1, parent_ad_rep = AD_REP_FACTORY.create_generations(
         create_count=2)
     child_ad_rep2 = AD_REP_FACTORY.create_ad_rep()
     child_ad_rep2.parent_ad_rep = parent_ad_rep
     child_ad_rep2.save()
     consumers = CONSUMER_FACTORY.create_consumers(create_count=3)
     for consumer in consumers:
         CONSUMER_FACTORY.qualify_consumer(consumer)
     AdRepConsumer.objects.create(consumer=consumers[0],
         ad_rep=child_ad_rep1)
     AdRepConsumer.objects.create(consumer=consumers[1],
         ad_rep=child_ad_rep2)
     AdRepConsumer.objects.create(consumer=consumers[2],
         ad_rep=child_ad_rep2)
     self.client.login(username='super', password='secret')
     response = self.client.get(reverse('admin-downline-consumers',
         kwargs={'ad_rep_id': parent_ad_rep.id}))
     self.assertEqual(response.status_code, 200)
     self.assertContains(response, 'Recruitment Activity for %s %s' %
         (parent_ad_rep.first_name, parent_ad_rep.last_name))
     self.assertContains(response, 'Customers')
     self.assertContains(response, '%s %s' %
         (child_ad_rep1.first_name, child_ad_rep1.last_name))
     self.assertContains(response,
         "Click a name to view that Advertising Representative's")
     self.assertTrue(response.content.count('>1</strong>'), 2)
     # Output is sorted by consumer count;, child_ad_rep2 comes first.
     self.assertTrue(response.content.index(child_ad_rep2.first_name) <
         response.content.index(child_ad_rep1.first_name))
     # Only market managers (rank) get this text:
     self.assertNotContains(response, 'commission is paid to you')
開發者ID:wcirillo,項目名稱:ten,代碼行數:37,代碼來源:test_ad_rep_account_views.py

示例2: test_redo_update

# 需要導入模塊: from consumer.factories.consumer_factory import CONSUMER_FACTORY [as 別名]
# 或者: from consumer.factories.consumer_factory.CONSUMER_FACTORY import create_consumers [as 別名]
 def test_redo_update(self):
     """ Assert a flyer that has already been calculated into the consumer 
     bonus pool is not calculated again.
     """
     ad_rep = AD_REP_FACTORY.create_ad_rep()
     self.assertEqual(ad_rep.consumer_points, 0)
     flyer = Flyer.objects.create(site_id=2, is_approved=True)
     flyer_recipients = CONSUMER_FACTORY.create_consumers(create_count=5)
     for consumer in flyer_recipients:
         AdRepConsumer.objects.create(ad_rep=ad_rep, consumer_id=consumer.id)
     BonusPoolFlyer.objects.create(flyer_id=flyer.id, calculate_status='2')
     UPDATE_CONSUMER_BONUS_POOL(flyer.id, [])
     ad_rep = AdRep.objects.get(id=ad_rep.id)
     self.assertEqual(ad_rep.consumer_points, 0)
開發者ID:wcirillo,項目名稱:ten,代碼行數:16,代碼來源:test_tasks.py

示例3: qualify_ad_rep

# 需要導入模塊: from consumer.factories.consumer_factory import CONSUMER_FACTORY [as 別名]
# 或者: from consumer.factories.consumer_factory.CONSUMER_FACTORY import create_consumers [as 別名]
 def qualify_ad_rep(ad_rep):
     """ Set the condition such that ad_rep.is_qualified() returns True. """
     consumers = CONSUMER_FACTORY.create_consumers(create_count=10)
     for consumer in consumers:
         CONSUMER_FACTORY.qualify_consumer(consumer)
         AdRepConsumer.objects.create(ad_rep=ad_rep, consumer=consumer)
開發者ID:wcirillo,項目名稱:ten,代碼行數:8,代碼來源:ad_rep_factory.py


注:本文中的consumer.factories.consumer_factory.CONSUMER_FACTORY.create_consumers方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。