7
async def test_crud_lot(async_inventory_client, headers, stores, companies, products):
9
Проверяем rруд вокруг товаров
12
'company_id': companies[0].id.__str__(),
13
'expiration_date': datetime.datetime.now().isoformat(),
14
'product_id': products[0].id.__str__(),
15
'external_number': '1000001',
18
response = await async_inventory_client.post("/api/inventory/lot", json=create_data, headers=headers['superadmin'])
19
assert response.status_code == 200
20
data = response.json()
25
'expiration_date': datetime.datetime.now().isoformat(),
26
'product_id': products[0].id.__str__(),
27
'external_number': '1000002',
29
response = await async_inventory_client.put(f"/api/inventory/lot/{lot_id_1}", json=update_data, headers=headers['superadmin'], )
30
assert response.status_code == 200
33
response = await async_inventory_client.get("/api/inventory/lot", headers=headers['superadmin'], params={'size': 100, 'search': '1000002'}
35
assert response.status_code == 200
36
data = response.json()
37
assert len(data.get('data')) == 1
39
response = await async_inventory_client.delete(f"/api/inventory/lot/{lot_id_1}", headers=headers['superadmin'], )
40
assert response.status_code == 200
44
async def test_crud_quant(async_inventory_client, headers, stores, companies, products, lots, uoms, locations):
46
Проверяем rруд вокруг товаров
49
'company_id': companies[0].id.__str__(),
50
'product_id': products[0].id.__str__(),
51
'store_id': stores[0].id.__str__(),
52
'location_id': locations['place'].id.__str__(),
53
'lot_id': lots[0].id.__str__(),
55
'reserved_quantity': 5,
56
'expiration_date': datetime.datetime.now().isoformat(),
57
'uom_id': uoms[0].id.__str__()
59
response = await async_inventory_client.post("/api/inventory/quant", json=create_data, headers=headers['superadmin'])
60
assert response.status_code == 200
61
data = response.json()
66
'product_id': products[0].id.__str__(),
67
'store_id': stores[1].id.__str__(),
68
'location_id': locations['zone'].id.__str__(),
71
'reserved_quantity': 8,
72
'expiration_date': datetime.datetime.now().isoformat(),
73
'uom_id': uoms[1].id.__str__()
75
response = await async_inventory_client.put(f"/api/inventory/quant/{lot_id_1}", json=update_data, headers=headers['superadmin'], )
76
assert response.status_code == 200
79
response = await async_inventory_client.get("/api/inventory/quant", headers=headers['superadmin'], params={'size': 100, 'created_at_gte': '2023-01-01'}
81
assert response.status_code == 200
82
data = response.json()
83
assert len(data.get('data')) == 1
85
response = await async_inventory_client.delete(f"/api/inventory/quant/{lot_id_1}", headers=headers['superadmin'], )
86
assert response.status_code == 200