Landing page adoption
[releng.git] / utils / test / testapi / opnfv_testapi / common / raises.py
1 ##############################################################################
2 # Copyright (c) 2017 ZTE Corp
3 # feng.xiaowei@zte.com.cn
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
9 import httplib
10
11 from tornado import web
12
13
14 class Raiser(object):
15     code = httplib.OK
16
17     def __init__(self, reason):
18         raise web.HTTPError(self.code, reason)
19
20
21 class BadRequest(Raiser):
22     code = httplib.BAD_REQUEST
23
24
25 class Forbidden(Raiser):
26     code = httplib.FORBIDDEN
27
28
29 class NotFound(Raiser):
30     code = httplib.NOT_FOUND
31
32
33 class Unauthorized(Raiser):
34     code = httplib.UNAUTHORIZED
35
36
37 class CodeTBD(object):
38     def __init__(self, code, reason):
39         raise web.HTTPError(code, reason)