Added simple functional test
This commit is contained in:
parent
91155f6994
commit
943f8402ab
|
@ -112,7 +112,11 @@ class ServicesController(object):
|
|||
logger.error("Can't find documentation at %s", filepath)
|
||||
self.services_info = {}
|
||||
return
|
||||
self.services_info = json.load(open(filepath))
|
||||
try:
|
||||
self.services_info = json.load(open(filepath))
|
||||
except ValueError:
|
||||
logger.error("Failed to load %s", filepath)
|
||||
raise
|
||||
for key, info in self.services_info.items():
|
||||
# Add the path into each element, this is to make
|
||||
# consumption by the JS client easier.
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
.. swagger:tag:: simple
|
||||
:synopsis: Simple Tag
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
.. http:get:: /
|
||||
:title: Simple route
|
||||
|
||||
:tag: simple
|
||||
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"identity/v2/": {
|
||||
"version": "v2",
|
||||
"license": {
|
||||
"url": "http://www.apache.org/licenses/LICENSE-2.0.html",
|
||||
"name": "Apache 2.0"
|
||||
},
|
||||
"service": "identity",
|
||||
"title": "Identity"
|
||||
}
|
||||
}
|
|
@ -45,3 +45,42 @@ class TestRootController(FunctionalTest):
|
|||
def test_get_not_found(self):
|
||||
response = self.app.get('/a/bogus/url', expect_errors=True)
|
||||
assert response.status_int == 404
|
||||
|
||||
def test_get_doc_index(self):
|
||||
response = self.app.get('/doc/')
|
||||
assert response.json == [
|
||||
{'url': 'identity/v2/',
|
||||
'version': 'v2',
|
||||
'license': {'url': 'http://www.apache.org/licenses/LICENSE-2.0.html',
|
||||
'name': 'Apache 2.0'},
|
||||
'service': 'identity',
|
||||
'title': 'Identity'}]
|
||||
assert response.status_int == 200
|
||||
|
||||
def test_get_doc_identity(self):
|
||||
response = self.app.get('/doc/identity/', expect_errors=True)
|
||||
assert response.status_int == 404
|
||||
|
||||
def test_get_doc_identity_v2(self):
|
||||
response = self.app.get('/doc/identity/v2/')
|
||||
assert response.json == \
|
||||
{'info':
|
||||
{'url': 'identity/v2/',
|
||||
'version': 'v2',
|
||||
'license': {'url': 'http://www.apache.org/licenses/LICENSE-2.0.html',
|
||||
'name': 'Apache 2.0'},
|
||||
'service': 'identity',
|
||||
'title': 'Identity'},
|
||||
'paths': {'/': [{'responses': {},
|
||||
'parameters': [],
|
||||
'produces': [],
|
||||
'consumes': [],
|
||||
'tags': ['simple'],
|
||||
'summary': '',
|
||||
'title': 'Simple route',
|
||||
'method': 'get',
|
||||
'description': ''}]},
|
||||
'tags': [{'description': '',
|
||||
'name': 'simple',
|
||||
'summary': 'Simple Tag'}]}
|
||||
assert response.status_int == 200
|
||||
|
|
Loading…
Reference in New Issue