Esempio n. 1
0
    def test_update_product(self):
        meli = MeliInterface()
        products = meli.get_active_products()
        assert len(products) > 0
        meli_product = products[0]
        product_id = meli_product["id"]
        product_title = meli_product["title"]
        product_price = meli_product["price"]
        product_qty = meli_product["available_quantity"]
        print(f'\nOriginal product: {product_id}')
        print(f'    title: {product_title}')
        print(f'    price: {product_price}')
        print(f'    available_quantity: {product_qty}')
        assert product_qty > 0
        # Can do the test if product not have stock.
        assert meli_product["available_quantity"] > 0

        # New values.
        new_product_qty = product_qty - 1
        new_product_price = product_price - 1
        print(f'Will be change to: quantity: {new_product_qty}, price: {new_product_price}')

        # Update product.
        meli.update_product(product_id, new_product_price, new_product_qty)
        changed_product = meli.get_product(product_id)
        assert  changed_product["price"] == new_product_price   
        assert  changed_product["available_quantity"] == new_product_qty
        print(f'Changed product: {changed_product["id"]}')
        print(f'    price: {changed_product["price"]}')
        print(f'    available_quantity: {changed_product["available_quantity"]}')

        # Restore product.
        meli.update_product(product_id, product_price, product_qty)
        restored_product = meli.get_product(product_id)
        assert  restored_product["price"] == product_price   
        assert  restored_product["available_quantity"] == product_qty
        print(f'Restored product: {restored_product ["id"]}')
        print(f'    price: {restored_product["price"]}')
        print(f'    available_quantity: {restored_product["available_quantity"]}')
Esempio n. 2
0
zunka_products = zunka.get_all_products()
#  print(list(zunka_products))

#  debug(f'Zunka products with meli id: {len(zunka_products)}')
debug(f'All Zunka products: {len(zunka_products)}')
#  for key, value in zunka_products.items():
#  print(key)
#  print(value['storeProductTitle'])
#  print('\n')

debug('Temporary finish.')
exit()
print('Not exited!')

meli = MeliInterface()
meli_products = meli.get_active_products()
meli_products = MeliInterface.make_dic_id_product(meli_products)

debug(f'All Meli products: {len(meli_products)}')
#  for key, value in meli_products.items():
#  print(key)
#  print(value)

#  debug('Temporary finish.')
#  exit()
#  print('Not exited!')

# Check zunka products consistence.
check_result_zunka = zunka.check_zunka_products_consistence(
    zunka_products, meli_products)
debug(f'Zunka consitence result: {check_result_zunka}')
Esempio n. 3
0
 def test_get_active_products(self):
     meli = MeliInterface()
     products = meli.get_active_products()
     assert len(products) > 0
     #  print(json.dumps(products[0], indent=4, sort_keys=True))
     print(f'Products len: {len(products)}')