Skip to content

Instantly share code, notes, and snippets.

@vojd
Created December 6, 2012 14:58
Show Gist options
  • Save vojd/4225018 to your computer and use it in GitHub Desktop.
Save vojd/4225018 to your computer and use it in GitHub Desktop.
simple_django_test
def add_to_cart(product):
resp = self.client.post(reverse('add_to_cart_view', {'product' : product.pk}
return resp
def test_add_to_cart():
# add all products to cart
for product in Product.objects.all():
resp = add_to_cart(product)
self.assertEqual(resp.status_code, 302)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment