DonConfia_Dev/modules/sale_don_confiao/tests/DonConfiaoCatalogToolsTest.py
2025-02-08 16:19:48 -05:00

82 lines
2.0 KiB
Python

import pudb
import requests
import json
url = 'http://localhost:18030'
key = '9a9ffc430146447d81e6698240199a4be2b0e774cb18474999d0f60e33b5b1eb1cfff9d9141346a98844879b5a9e787489c891ddc8fb45cc903b7244cab64fb1'
db = 'tryton'
application_name = 'sale_don_confiao'
base_url = '{}/{}/{}'.format(url, db, application_name)
response_parties = requests.get(
base_url+'/parties',
headers={
'Authorization': f'bearer {key}',
})
response_party = requests.get(
base_url + '/party/2753',
headers={
'Authorization': f'bearer {key}',
})
response_post_party = requests.post(
base_url+'/parties',
headers={
'Authorization': f'bearer {key}',
}, data=json.dumps({
"name": "Alejandro",
}))
response_categories = requests.get(
base_url+'/categories',
headers={
'Authorization': f'bearer {key}',
})
response_products = requests.get(
base_url+'/products',
headers={
'Authorization': f'bearer {key}',
})
response_search_products = requests.get(
base_url+'/search_products/Aceite',
headers={
'Authorization': f'bearer {key}',
})
response_sales = requests.get(
base_url+'/sales',
headers={
'Authorization': f'bearer {key}',
})
response_sale = requests.get(
base_url+'/sale/120',
headers={
'Authorization': f'bearer {key}',
})
response = requests.post(
base_url + '/post_sale',
headers={
'Authorization': f'bearer {key}',
}, data=json.dumps({
"party": 2573,
"company": 1,
"currency": 1,
"invoice_method": "order",
"shipment_method": "order",
"lines": [["create", [{
"type": "line",
"product": "1",
"quantity": "1",
"unit_price": "10",
"unit": "1"
}]]],
"state": "draft"
}))
pudb.set_trace()