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