def test_new_cart_after_checkout_user(rqst, reg_user): rqst.user = reg_user cart = CartProxy(rqst) cart.checkout() assert cart.cart.checked_out is True cart2 = CartProxy(rqst) assert cart.cart != cart2.cart assert cart2.cart.checked_out is False
def test_get_user_last_cart(user, rqst): rqst.user = user cart_proxy = CartProxy(rqst) cart_proxy.checkout() cart_proxy = CartProxy(rqst) cart = cart_proxy.get_user_last_cart(user) assert cart_proxy.n_carts(user) == 2 assert cart == cart_proxy.cart
def test_new_cart_after_checkout_user(rqst, user): rqst.user = user cart_proxy = CartProxy(rqst) cart_proxy.checkout() assert cart_proxy.cart.checked_out is True cart_proxy2 = CartProxy(rqst) assert cart_proxy.cart != cart_proxy2.cart assert cart_proxy2.cart.checked_out is False
def test_new_cart_after_checkout_user(self): r = HttpRequest() r.session = {} r.user = self.user cart = CartProxy(r) cart.checkout() self.assertEquals(cart.cart.checked_out, True) cart2 = CartProxy(r) self.assertNotEquals(cart.cart, cart2.cart) self.assertEquals(cart2.cart.checked_out, False)
def test_user_n_carts(user, rqst): rqst.user = user cart_proxy = CartProxy(rqst) cart_proxy.checkout() cart_proxy = CartProxy(rqst) assert cart_proxy.n_carts(user) == 2