Feat: Test customer_order, bar_order
This commit is contained in:
parent
f697200d13
commit
9ee21faba6
@ -201,7 +201,7 @@ def print_ticket_file_kitchen(info: Info):
|
||||
data = json.loads(data.replace("'", "\""))
|
||||
print_customer_order(data, address, waiter)
|
||||
|
||||
message = "!Impresión Realizada!"
|
||||
message = "!Impresion Realizada!"
|
||||
|
||||
return Response(content=message, status_code=200)
|
||||
|
||||
|
24
Api/test/fixtures/customer_order.json
vendored
Normal file
24
Api/test/fixtures/customer_order.json
vendored
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"party": "00-Consumidor Final",
|
||||
"tax_identifier_type": "NIT",
|
||||
"tax_identifier_code": "222222222",
|
||||
"address": "Dg 74A #C-2-56",
|
||||
"city": "Medellín",
|
||||
"zone": "CHIMENEA (CH)",
|
||||
"table": "CH1",
|
||||
"lines": [
|
||||
{"type": "line", "product": "Club negra", "description": "", "quantity": 1.0, "uom": "Unidad"},
|
||||
{"type": "line", "product": "Club roja", "description": "", "quantity": 1.0, "uom": "Unidad"},
|
||||
{"type": "line", "product": "Aguila ligth", "description": "", "quantity": 1.0, "uom": "Unidad"},
|
||||
{"type": "line", "product": "Té hatsu", "description": "", "quantity": 1.0, "uom": "Unidad"},
|
||||
{"type": "line", "product": "Aromatica frutos rojos", "description": "", "quantity": 1.0, "uom": "Unidad"},
|
||||
{"type": "title", "product": null, "description": null, "quantity": null, "uom": null},
|
||||
{"type": "line", "product": "Santiago Botero", "description": "", "quantity": 0.5, "uom": "Media Unidad"},
|
||||
{"type": "line", "product": "Villa Clara", "description": "", "quantity": 0.5, "uom": "Media Unidad"},
|
||||
{"type": "title", "product": null, "description": null, "quantity": null, "uom": null},
|
||||
{"type": "line", "product": "Granma", "description": "", "quantity": 1.0, "uom": "Media Unidad"},
|
||||
{"type": "title", "product": null, "description": null, "quantity": null, "uom": null},
|
||||
{"type": "line", "product": "Camilo Cienfuegos", "description": "", "quantity": 0.5, "uom": "Media Unidad"},
|
||||
{"type": "line", "product": "Propinas", "description": null, "quantity": 1.0, "uom": "Unidad"}],
|
||||
"deleted_lines": []
|
||||
}
|
@ -11,6 +11,7 @@ def load_json(file_path):
|
||||
with open(file_path, 'r') as filejson:
|
||||
return json.load(filejson)
|
||||
|
||||
|
||||
def test_print_bill():
|
||||
test_info = {
|
||||
"content": str(
|
||||
@ -24,3 +25,35 @@ def test_print_bill():
|
||||
response = client.post("/print_bill", json=test_info)
|
||||
assert response.status_code == 200
|
||||
assert response.content.decode() == "!Impresion Realizada!"
|
||||
|
||||
|
||||
def test_print_customer_order():
|
||||
test_info = {
|
||||
"content": str(
|
||||
json.dumps(
|
||||
load_json('test/fixtures/customer_order.json')
|
||||
)),
|
||||
"ip_printer": "192.168.1.100",
|
||||
"user_name": "Juan"
|
||||
}
|
||||
|
||||
response = client.post("/order_kitchen", json=test_info)
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.content.decode() == "!Impresion Realizada!"
|
||||
|
||||
|
||||
def test_print_bar_order():
|
||||
test_info = {
|
||||
"content": str(
|
||||
json.dumps(
|
||||
load_json('test/fixtures/customer_order.json')
|
||||
)),
|
||||
"ip_printer": "192.168.1.100",
|
||||
"user_name": "Juan"
|
||||
}
|
||||
|
||||
response = client.post("/order_bar", json=test_info)
|
||||
|
||||
assert response.status_code == 200
|
||||
assert response.content.decode() == "!Impresion Realizada!"
|
||||
|
Loading…
Reference in New Issue
Block a user