コード例 #1
0
    def test_find_shopcart_that_doesnt_exist(self):
        """ Try to find a non-existant Shopcart """
        Shopcart(2).save()

        cart = Shopcart.find(5)

        self.assertIsNone(cart)
コード例 #2
0
    def test_find_a_shopcart(self):
        """ Find a shopcart by uid """
        Shopcart(2).save()
        Shopcart(5).save()

        cart = Shopcart.find(5)

        self.assertEqual(cart.user_id, 5)
        self.assertEqual(len(cart.products), 0)