Coverage for model/test.py: 100%
25 statements
« prev ^ index » next coverage.py v7.3.2, created at 2024-11-05 04:22 +0000
« prev ^ index » next coverage.py v7.3.2, created at 2024-11-05 04:22 +0000
1from flask import Blueprint, current_app, request
3from .auth import *
4from .utils import *
6__all__ = ['test_api']
8test_api = Blueprint('test_api', __name__)
11@test_api.route('/')
12@login_required
13def test(user):
14 return HTTPResponse(user.username)
17@test_api.route('/role')
18@identity_verify(0, 1, ...)
19def role(user):
20 return HTTPResponse(str(user.obj.role))
23@test_api.route('/log')
24def log():
25 current_app.logger.debug('this is a DEBUG log')
26 current_app.logger.info('this is a INFO log')
27 current_app.logger.warning('this is a WARNING log')
28 current_app.logger.error('this is a ERROR log')
29 current_app.logger.critical('this is a CRITICAL log')
30 return HTTPResponse('check the log')
33@test_api.route('/header')
34def check_header():
35 current_app.logger.debug(f'{request.headers}')
36 return HTTPResponse('ok')