mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-26 18:06:17 -05:00
Configs can be saved in background using switches.
This commit is contained in:
parent
44d4921c84
commit
d54735c4bb
53 changed files with 967 additions and 574 deletions
|
|
@ -76,33 +76,33 @@ def test_item_api(test_session, init_test_inventory, test_client):
|
|||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_inventory_api(test_session, test_async_client):
|
||||
async def test_inventory_api(test_session, async_client):
|
||||
"""An Inventory can be created."""
|
||||
inventory = dict(name='foo')
|
||||
request, response = await test_async_client.post('/api/inventory', content=json.dumps(inventory))
|
||||
request, response = await async_client.post('/api/inventory', content=json.dumps(inventory))
|
||||
assert response.status_code == HTTPStatus.CREATED, response.status_code
|
||||
|
||||
request, response = await test_async_client.get('/api/inventory')
|
||||
request, response = await async_client.get('/api/inventory')
|
||||
assert response.status_code == HTTPStatus.OK
|
||||
inventory = response.json['inventories'][0]
|
||||
inventory_id = inventory['id']
|
||||
|
||||
request, response = await test_async_client.get(f'/api/inventory/{inventory_id}')
|
||||
request, response = await async_client.get(f'/api/inventory/{inventory_id}')
|
||||
assert response.status_code == HTTPStatus.OK
|
||||
|
||||
request, response = await test_async_client.get('/api/inventory/categories')
|
||||
request, response = await async_client.get('/api/inventory/categories')
|
||||
assert response.status_code == HTTPStatus.OK
|
||||
|
||||
request, response = await test_async_client.get('/api/inventory/brands')
|
||||
request, response = await async_client.get('/api/inventory/brands')
|
||||
assert response.status_code == HTTPStatus.OK
|
||||
|
||||
inventory = dict(name='new name')
|
||||
request, response = await test_async_client.put(f'/api/inventory/{inventory_id}', content=json.dumps(inventory))
|
||||
request, response = await async_client.put(f'/api/inventory/{inventory_id}', content=json.dumps(inventory))
|
||||
assert response.status_code == HTTPStatus.NO_CONTENT, response.status_code
|
||||
|
||||
request, response = await test_async_client.delete(f'/api/inventory/{inventory_id}')
|
||||
request, response = await async_client.delete(f'/api/inventory/{inventory_id}')
|
||||
assert response.status_code == HTTPStatus.NO_CONTENT, response.status_code
|
||||
|
||||
request, response = await test_async_client.get('/api/inventory')
|
||||
request, response = await async_client.get('/api/inventory')
|
||||
assert response.status_code == HTTPStatus.OK
|
||||
assert len(response.json['inventories']) == 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue