1
from unittest import mock
4
from sqlalchemy import func, select
7
async def test_crud_location_type(async_inventory_client, headers, stores, companies):
9
Проверяем rруд вокруг товаров
12
'company_id': companies[0].id.__str__(),
13
'title': 'Partner Location',
14
'location_class': 'partner'
16
response = await async_inventory_client.post("/api/inventory/location_type", json=create_data, headers=headers['superadmin'])
17
assert response.status_code == 200
18
data = response.json()
19
location_type_id_1 = data['id']
23
'company_id': companies[0].id.__str__(),
24
'location_class': 'place',
25
'title': 'Place Location',
27
response = await async_inventory_client.put(f"/api/inventory/location_type/{location_type_id_1}", json=update_data, headers=headers['superadmin'], )
28
assert response.status_code == 200
31
response = await async_inventory_client.get("/api/inventory/location_type", headers=headers['superadmin'], params={'size': 100, 'search': 'Place'}
33
assert response.status_code == 200
34
data = response.json()
35
assert len(data.get('data')) == 1
37
response = await async_inventory_client.delete(f"/api/inventory/location_type/{location_type_id_1}", headers=headers['superadmin'], )
38
assert response.status_code == 200
42
async def test_crud_location(async_inventory_client, headers, stores, companies, location_types, product_categories, product_storage_types, uom_categories, uoms, products):
44
Проверяем rруд вокруг товаров
47
'company_id': companies[0].id.__str__(),
48
'title': 'place location',
49
'store_id': stores[0].id.__str__(),
51
'location_type_id': location_types['place'].id.__str__(),
53
response = await async_inventory_client.post("/api/inventory/location", json=create_data, headers=headers['superadmin'])
54
assert response.status_code == 200
55
data = response.json()
56
location_id = data['id']
60
'title': 'zone location',
62
'location_type_id': location_types['zone'].id.__str__(),
64
response = await async_inventory_client.put(f"/api/inventory/location/{location_id}", json=update_data, headers=headers['superadmin'], )
65
assert response.status_code == 200
68
response = await async_inventory_client.get("/api/inventory/location", headers=headers['superadmin'], params={'size': 100, 'search': 'zone location'}
70
assert response.status_code == 200
71
data = response.json()
72
assert len(data.get('data')) == 1
74
response = await async_inventory_client.delete(f"/api/inventory/location/{location_id}", headers=headers['superadmin'], )
75
assert response.status_code == 200