Exemple #1
0
    def test_move_order_ok(self):

        cart = Cart()
        cart.product_id = 129
        cart.quantity = 1
        cart.subtotal = 34950
        cart.user_id = 733
        cart.size = '37'
        cart.price = 34950
        cart.Save()
        order = Order()
        order.voucher = ''
        order.type = 1
        order.subtotal = 34950
        order.shipping = 2490
        order.tax = 0
        order.total = 37440
        order.items_quantity = 1
        order.products_quantity = 1
        order.user_id = 733
        order.billing_id = 69
        order.shipping_id = 69
        order.payment_type = 2
        order.Save()

        order_detail = OrderDetail()
        order_detail.order_id = order.id
        order_detail.quantity = 1
        order_detail.product_id = 129
        order_detail.subtotal = 34950
        order_detail.size = '37'
        order_detail.price = 34950
        order_detail.Save()

        od = order_detail.ListByOrderId(order.id, 0, 0)

        ExitoHandler.moveStock(od, 733)

        query = '''\
                select * from "Kardex" 
                where cellar_id = 5 
                and product_sku = 'GDF-PV14-Lile-C9' 
                and size_id = 3 
                order by date desc limit 1'''
        kardex = BaseModel.execute_query(query)

        if len(kardex) > 0:
            self.assertEqual(kardex[0]["balance_units"], 3)

            query = '''\
                select * from "Kardex" 
                where cellar_id = 12 
                and product_sku = 'GDF-PV14-Lile-C9' 
                and size_id = 3 
                order by date desc limit 1'''
        kardex = BaseModel.execute_query(query)

        if len(kardex) > 0:
            self.assertEqual(kardex[0]["balance_units"], 2)
Exemple #2
0
    def test_orden_detail_failure(self):
        detail = ExitoHandler.getDetalleOrden([])
        assert detail == ""

        # exception case
        detail = ExitoHandler.getDetalleOrden([{}])
        assert detail == ""

        # exception case
        detail = ExitoHandler.getDetalleOrden([{"foo": "bar"}])
        assert detail == ""
Exemple #3
0
    def test_orden_detail_acceptance(self):

        # acceptance test
        l = [{
            "product_id": "foo",
            "price": 1,
            "name": "foo",
            "size": "foo",
            "quantity": "foo",
            "color": "foo",
            "subtotal": 1
        }]

        detail = ExitoHandler.getDetalleOrden(l)
        assert detail != ""
Exemple #4
0
    def test_inexisting_webpay_file(self):

        order = Order()
        res_order = order.InitById(402)
        response = ExitoHandler.readWebpayMAC('Testttttt', order)
        self.assertDictEqual(response, {})
Exemple #5
0
    def test_order_not_pending_2(self):

        response = ExitoHandler.verifyOrderState('')
        self.assertEqual(response, None)
Exemple #6
0
    def test_check_order_exists_2(self):

        response = ExitoHandler.verifyOrderState(402)
        self.assertNotEqual(response, None)