mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-11 18:11:21 +08:00
fix: make sure flask server is up
This commit is contained in:
@@ -93,6 +93,7 @@ def validate_request(func):
|
||||
def index():
|
||||
return "Hello World!"
|
||||
|
||||
|
||||
@app.route('/api/get-token', methods=['POST'])
|
||||
def get_token():
|
||||
device_sn = request.headers.get('device_sn', "")
|
||||
@@ -121,6 +122,7 @@ def get_token():
|
||||
response.headers["Content-Type"] = "application/json"
|
||||
return response
|
||||
|
||||
|
||||
@app.route('/api/users')
|
||||
@validate_request
|
||||
def get_users():
|
||||
@@ -134,6 +136,7 @@ def get_users():
|
||||
response.headers["Content-Type"] = "application/json"
|
||||
return response
|
||||
|
||||
|
||||
@app.route('/api/reset-all')
|
||||
@validate_request
|
||||
def clear_users():
|
||||
@@ -145,6 +148,7 @@ def clear_users():
|
||||
response.headers["Content-Type"] = "application/json"
|
||||
return response
|
||||
|
||||
|
||||
@app.route('/api/users/<int:uid>', methods=['POST'])
|
||||
@validate_request
|
||||
def create_user(uid):
|
||||
@@ -167,6 +171,7 @@ def create_user(uid):
|
||||
response.headers["Content-Type"] = "application/json"
|
||||
return response
|
||||
|
||||
|
||||
@app.route('/api/users/<int:uid>')
|
||||
@validate_request
|
||||
def get_user(uid):
|
||||
@@ -188,6 +193,7 @@ def get_user(uid):
|
||||
response.headers["Content-Type"] = "application/json"
|
||||
return response
|
||||
|
||||
|
||||
@app.route('/api/users/<int:uid>', methods=['PUT'])
|
||||
@validate_request
|
||||
def update_user(uid):
|
||||
@@ -209,6 +215,7 @@ def update_user(uid):
|
||||
response.headers["Content-Type"] = "application/json"
|
||||
return response
|
||||
|
||||
|
||||
@app.route('/api/users/<int:uid>', methods=['DELETE'])
|
||||
@validate_request
|
||||
def delete_user(uid):
|
||||
|
||||
@@ -33,7 +33,7 @@ class ApiServerUnittest(unittest.TestCase):
|
||||
)
|
||||
cls.flask_process.start()
|
||||
cls.httpbin_process.start()
|
||||
time.sleep(0.1)
|
||||
time.sleep(1)
|
||||
cls.api_client = requests.Session()
|
||||
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user