
Moves unit tests under the ims directory to the root test directory Change-Id: Idc8e356ce74970bacf16c3046b72e57fe9cbe5eb
40 lines
1.1 KiB
Python
Executable File
40 lines
1.1 KiB
Python
Executable File
from orm.services.image_manager.ims.controllers.v1.v1 import V1Controller
|
|
from pecan import conf, expose
|
|
from webob.exc import status_map
|
|
|
|
|
|
class RootController(object):
|
|
v1 = V1Controller()
|
|
|
|
@expose(template='json')
|
|
def get(self):
|
|
"""Method to handle GET /
|
|
prameters: None
|
|
return: dict describing image command version information
|
|
"""
|
|
|
|
return {
|
|
"versions": {
|
|
"values": [
|
|
{
|
|
"orm": "stable",
|
|
"id": "v1",
|
|
"links": [
|
|
{
|
|
"href": conf.application_root
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
|
|
@expose('error.html')
|
|
def error(self, status):
|
|
try:
|
|
status = int(status)
|
|
except ValueError: # pragma: no cover
|
|
status = 500
|
|
message = getattr(status_map.get(status), 'explanation', '')
|
|
return dict(status=status, message=message)
|