def get_users():
    sock = SocketClient(settings.MOCK_HOST, settings.MOCK_PORT)
    mock_response = sock.get('/users')
    if mock_response:
        return jsonify(mock_response), 200
    else:
        return jsonify({"status": "fail"}), 400
def mock_error():
    sock = SocketClient(settings.MOCK_HOST, settings.MOCK_PORT)
    mock_response = sock.get('/error500')
    if mock_response['status'] == 'timeout':
        return jsonify({"status": "fail"}), 500
    else:
        return jsonify({"status": "ok"}), 200
def index():
    sock = SocketClient(settings.MOCK_HOST, settings.MOCK_PORT)
    try:
        mock_response = sock.get('/')
    except ConnectionRefusedError as e:
        return jsonify({"status": "fail"}), 500
    if mock_response['status'] == 'ok':
        return jsonify({"status": "ok"}), 200
    else:
        return jsonify({"status": "fail"}), 400
Exemple #4
0
 def app(self):
     application = app.run_app(settings.APP_HOST, settings.APP_PORT)
     yield application
     socket = SocketClient(settings.APP_HOST, settings.APP_PORT)
     socket.get('/shutdown')