This repository has been archived on 2024-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
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()) == {
|
|
|
|
'/tags/{id}/device',
|
|
|
|
'/inventories/',
|
|
|
|
'/apidocs',
|
|
|
|
'/users/',
|
|
|
|
'/devices/',
|
|
|
|
'/tags/',
|
|
|
|
'/snapshots/',
|
|
|
|
'/users/login',
|
|
|
|
'/events/'
|
|
|
|
}
|
|
|
|
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'
|
|
|
|
}
|
|
|
|
assert len(docs['definitions']) == 46
|