add more render basic tests

This commit is contained in:
Cayo Puigdefabregas 2022-04-29 18:23:05 +02:00
parent 7fe33f3a42
commit 921049a28b
1 changed files with 40 additions and 12 deletions

View File

@ -1,7 +1,7 @@
import pytest import pytest
from ereuse_devicehub.devicehub import Devicehub
from ereuse_devicehub.client import Client from ereuse_devicehub.client import Client
from ereuse_devicehub.devicehub import Devicehub
@pytest.mark.mvp @pytest.mark.mvp
@ -28,37 +28,65 @@ def test_api_docs(client: Client):
"""Tests /apidocs correct initialization.""" """Tests /apidocs correct initialization."""
docs, _ = client.get('/apidocs') docs, _ = client.get('/apidocs')
assert set(docs['paths'].keys()) == { assert set(docs['paths'].keys()) == {
'/',
'/actions/', '/actions/',
'/apidocs',
'/allocates/', '/allocates/',
'/apidocs',
'/deallocates/', '/deallocates/',
'/deliverynotes/', '/deliverynotes/',
'/devices/', '/devices/',
'/devices/static/{filename}', '/devices/static/{filename}',
'/documents/static/{filename}',
'/documents/actions/', '/documents/actions/',
'/documents/erasures/',
'/documents/devices/',
'/documents/stamps/',
'/documents/wbconf/{wbtype}',
'/documents/internalstats/',
'/documents/stock/',
'/documents/check/', '/documents/check/',
'/documents/devices/',
'/documents/erasures/',
'/documents/internalstats/',
'/documents/lots/', '/documents/lots/',
'/versions/', '/documents/stamps/',
'/manufacturers/', '/documents/static/{filename}',
'/documents/stock/',
'/documents/wbconf/{wbtype}',
'/inventory/action/add/',
'/inventory/action/allocate/add/',
'/inventory/action/datawipe/add/',
'/inventory/action/trade/add/',
'/inventory/device/',
'/inventory/device/add/',
'/inventory/device/{id}/',
'/inventory/export/{export_id}/',
'/inventory/lot/add/',
'/inventory/lot/{id}/',
'/inventory/lot/{id}/del/',
'/inventory/lot/{lot_id}/device/',
'/inventory/lot/{lot_id}/device/add/',
'/inventory/lot/{lot_id}/trade-document/add/',
'/inventory/lot/{lot_id}/upload-snapshot/',
'/inventory/tag/devices/add/',
'/inventory/tag/devices/{id}/del/',
'/inventory/upload-snapshot/',
'/labels/',
'/labels/add/',
'/labels/print',
'/labels/unnamed/add/',
'/labels/{id}/',
'/licences/', '/licences/',
'/lives/', '/lives/',
'/login/',
'/logout/',
'/lots/', '/lots/',
'/lots/{id}/children', '/lots/{id}/children',
'/lots/{id}/devices', '/lots/{id}/devices',
'/manufacturers/',
'/metrics/', '/metrics/',
'/profile/',
'/set_password/',
'/tags/', '/tags/',
'/tags/{tag_id}/device/{device_id}', '/tags/{tag_id}/device/{device_id}',
'/trade-documents/', '/trade-documents/',
'/users/', '/users/',
'/users/login/', '/users/login/',
'/users/logout/', '/users/logout/',
'/versions/',
} }
assert docs['info'] == {'title': 'Devicehub', 'version': '0.2'} assert docs['info'] == {'title': 'Devicehub', 'version': '0.2'}
assert docs['components']['securitySchemes']['bearerAuth'] == { assert docs['components']['securitySchemes']['bearerAuth'] == {
@ -67,6 +95,6 @@ def test_api_docs(client: Client):
'description:': 'HTTP Basic scheme', 'description:': 'HTTP Basic scheme',
'type': 'http', 'type': 'http',
'scheme': 'basic', 'scheme': 'basic',
'name': 'Authorization' 'name': 'Authorization',
} }
assert len(docs['definitions']) == 132 assert len(docs['definitions']) == 132