Permalink
Browse files

improved tests to check that old carts get deleted

  • Loading branch information...
Ales Kocjancic
Ales Kocjancic committed Jul 26, 2012
1 parent 8948ace commit b0fa53f497c39bbf9907997a6007cad069221c89
Showing with 4 additions and 0 deletions.
  1. +4 −0 shop/tests/util.py
View
@@ -115,7 +115,10 @@ def test_having_filled_session_cart_and_empty_database_cart_returns_session_cart
ret = get_or_create_cart(self.request)
self.assertNotEqual(ret, None)
self.assertNotEqual(ret, database_cart)
+ self.assertNotEqual(ret.user, None)
+ self.assertEqual(ret.user, self.user)
self.assertEqual(ret, self.cart)
+ self.assertEqual(Cart.objects.filter(user=self.user).count(), 1)
def test_having_empty_session_cart_and_filled_database_cart_returns_database_cart(self):
setattr(self.request, 'user', self.user)
@@ -139,6 +142,7 @@ def test_having_two_filled_carts_returns_session_cart(self):
self.assertNotEqual(ret, None)
self.assertNotEqual(ret, database_cart)
self.assertEqual(ret, self.cart)
+ self.assertEqual(Cart.objects.filter(user=self.user).count(), 1)
class LoaderTestCase(TestCase):

0 comments on commit b0fa53f

Please sign in to comment.