2018-04-27 17:16:43 +00:00
|
|
|
import pytest
|
2018-04-10 15:06:39 +00:00
|
|
|
|
2018-06-24 14:57:49 +00:00
|
|
|
from ereuse_devicehub.client import Client
|
2018-04-27 17:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
def test_dependencies():
|
|
|
|
with pytest.raises(ImportError):
|
|
|
|
# Simplejson has a different signature than stdlib json
|
|
|
|
# should be fixed though
|
|
|
|
# noinspection PyUnresolvedReferences
|
|
|
|
import simplejson
|
2018-04-10 15:06:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
# noinspection PyArgumentList
|
2018-06-24 14:57:49 +00:00
|
|
|
def test_api_docs(client: Client):
|
|
|
|
"""Tests /apidocs correct initialization."""
|
|
|
|
docs, _ = client.get('/apidocs')
|
|
|
|
assert set(docs['paths'].keys()) == {
|
2018-09-20 09:51:25 +00:00
|
|
|
# todo this does not appear: '/tags/{id}/device',
|
2018-06-24 14:57:49 +00:00
|
|
|
'/apidocs',
|
|
|
|
'/users/',
|
|
|
|
'/devices/',
|
|
|
|
'/tags/',
|
2019-01-16 19:40:27 +00:00
|
|
|
'/users/login/',
|
2019-05-11 14:27:22 +00:00
|
|
|
'/actions/',
|
2018-09-11 19:50:40 +00:00
|
|
|
'/lots/',
|
2018-09-30 17:40:28 +00:00
|
|
|
'/manufacturers/',
|
2018-09-11 19:50:40 +00:00
|
|
|
'/lots/{id}/children',
|
2018-09-20 09:51:25 +00:00
|
|
|
'/lots/{id}/devices',
|
2018-11-21 13:26:56 +00:00
|
|
|
'/documents/erasures/',
|
2019-02-28 17:21:24 +00:00
|
|
|
'/documents/devices/',
|
2018-11-21 13:26:56 +00:00
|
|
|
'/documents/static/{filename}',
|
2018-10-16 06:46:55 +00:00
|
|
|
'/tags/{tag_id}/device/{device_id}',
|
|
|
|
'/devices/static/{filename}'
|
2018-06-24 14:57:49 +00:00
|
|
|
}
|
|
|
|
assert docs['info'] == {'title': 'Devicehub', 'version': '0.2'}
|
|
|
|
assert docs['components']['securitySchemes']['bearerAuth'] == {
|
|
|
|
'description': 'Basic scheme with token.',
|
|
|
|
'in': 'header',
|
|
|
|
'description:': 'HTTP Basic scheme',
|
|
|
|
'type': 'http',
|
|
|
|
'scheme': 'basic',
|
|
|
|
'name': 'Authorization'
|
|
|
|
}
|
2019-07-02 08:42:56 +00:00
|
|
|
assert len(docs['definitions']) == 110
|