選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

test_offer.py 779B

123456789101112131415161718192021
  1. from django.test import TestCase
  2. from oscar.apps.offer.views import RangeDetailView
  3. from oscar.test.factories import create_product
  4. from oscar.test.factories.offer import ConditionalOfferFactory
  5. class TestOffer(TestCase):
  6. def setUp(self):
  7. self.offer = ConditionalOfferFactory()
  8. self.non_public_product = create_product(is_public=False)
  9. self.offer.condition.range.add_product(self.non_public_product)
  10. def test_non_public_product_not_in_offer(self):
  11. self.assertFalse(self.non_public_product in self.offer.products())
  12. def test_non_public_product_not_in_range_detail_view(self):
  13. view = RangeDetailView()
  14. view.range = self.offer.condition.range
  15. self.assertFalse(self.non_public_product in view.get_queryset())