fix: make sure flask server is up

This commit is contained in:
debugtalk
2019-12-14 15:26:58 +08:00
parent d48386de7a
commit a62403e158
2 changed files with 8 additions and 1 deletions

View File

@@ -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):

View File

@@ -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