Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

wishlist_steps.py 742B

123456789101112131415161718192021222324252627
  1. from behave import *
  2. from nose.tools import *
  3. @given('they visit a product detail page')
  4. def step(context):
  5. from oscar.test import factories
  6. context.product = factories.create_product()
  7. context.response = context.browser.get(
  8. context.product.get_absolute_url(), user=context.user)
  9. @when('they click "Add to wishlist"')
  10. def step(context):
  11. form = context.response.forms['add_to_wishlist_form']
  12. context.response = form.submit()
  13. @then('a wishlist is created')
  14. def step(context):
  15. eq_(1, context.user.wishlists.all().count())
  16. @then('the product is in the wishlist')
  17. def step(context):
  18. wishlist = context.user.wishlists.all()[0]
  19. ok_(context.product in [line.product for line in wishlist.lines.all()])