Fixing test_basic.py::test_api_docs and test_workbench.py::test_real_custom

This commit is contained in:
nad 2020-07-15 13:11:50 +02:00
parent ce0aedd0d2
commit 02040199bb
2 changed files with 67 additions and 15 deletions

View File

@ -28,24 +28,76 @@ def test_api_docs(client: Client):
"""Tests /apidocs correct initialization."""
docs, _ = client.get('/apidocs')
assert set(docs['paths'].keys()) == {
# todo this does not appear: '/tags/{id}/device',
'/apidocs',
'/users/',
'/devices/',
'/tags/',
'/users/login/',
'/actions/',
'/apidocs',
'/batteries/{id}/merge/',
'/bikes/{id}/merge/',
'/cameras/{id}/merge/',
'/cellphones/{id}/merge/',
'/components/{id}/merge/',
'/computer-accessories/{id}/merge/',
'/computer-monitors/{id}/merge/',
'/computers/{id}/merge/',
'/cookings/{id}/merge/',
'/data-storages/{id}/merge/',
'/dehumidifiers/{id}/merge/',
'/deliverynotes/',
'/desktops/{id}/merge/',
'/devices/',
'/devices/static/{filename}',
'/devices/{id}/merge/',
'/displays/{id}/merge/',
'/diy-and-gardenings/{id}/merge/',
'/documents/devices/',
'/documents/erasures/',
'/documents/static/{filename}',
'/drills/{id}/merge/',
'/graphic-cards/{id}/merge/',
'/hard-drives/{id}/merge/',
'/homes/{id}/merge/',
'/hubs/{id}/merge/',
'/keyboards/{id}/merge/',
'/label-printers/{id}/merge/',
'/laptops/{id}/merge/',
'/lots/',
'/manufacturers/',
'/lots/{id}/children',
'/lots/{id}/devices',
'/documents/erasures/',
'/documents/devices/',
'/documents/static/{filename}',
'/manufacturers/',
'/memory-card-readers/{id}/merge/',
'/mice/{id}/merge/',
'/microphones/{id}/merge/',
'/mixers/{id}/merge/',
'/mobiles/{id}/merge/',
'/monitors/{id}/merge/',
'/motherboards/{id}/merge/',
'/network-adapters/{id}/merge/',
'/networkings/{id}/merge/',
'/pack-of-screwdrivers/{id}/merge/',
'/printers/{id}/merge/',
'/processors/{id}/merge/',
'/proofs/',
'/rackets/{id}/merge/',
'/ram-modules/{id}/merge/',
'/recreations/{id}/merge/',
'/routers/{id}/merge/',
'/sais/{id}/merge/',
'/servers/{id}/merge/',
'/smartphones/{id}/merge/',
'/solid-state-drives/{id}/merge/',
'/sound-cards/{id}/merge/',
'/sounds/{id}/merge/',
'/stairs/{id}/merge/',
'/switches/{id}/merge/',
'/tablets/{id}/merge/',
'/tags/',
'/tags/{tag_id}/device/{device_id}',
'/devices/static/{filename}',
'/deliverynotes/',
'/proofs/'
'/television-sets/{id}/merge/',
'/users/',
'/users/login/',
'/video-scalers/{id}/merge/',
'/videoconferences/{id}/merge/',
'/videos/{id}/merge/',
'/wireless-access-points/{id}/merge/'
}
assert docs['info'] == {'title': 'Devicehub', 'version': '0.2'}
assert docs['components']['securitySchemes']['bearerAuth'] == {

View File

@ -66,7 +66,6 @@ def test_workbench_server_condensed(user: UserClient):
assert device['tags'][0]['id'] == 'tag1'
@pytest.mark.mvp
@pytest.mark.xfail(reason='Functionality not yet developed.')
def test_workbench_server_phases(user: UserClient):
"""Tests the phases described in the docs section `Snapshots from
@ -274,7 +273,7 @@ def test_snapshot_real_eee_1001pxd_with_rate(user: UserClient):
@pytest.mark.mvp
def test_real_custom(user: UserClient):
s = file('real-custom.snapshot.11')
snapshot, _ = user.post(res=em.Snapshot, data=s, status=NeedsId)
snapshot, _ = user.post(res=em.Snapshot, data=s, status=201)
# todo insert with tag
@ -303,6 +302,7 @@ SNAPSHOTS_NEED_ID = {
@pytest.mark.xfail(reason='It needs to be fixed.')
@pytest.mark.mvp
@pytest.mark.parametrize('file',
(pytest.param(f, id=f.name)
for f in pathlib.Path(__file__).parent.joinpath('workbench_files').iterdir())