test_fuzzingclient.py: Indent with spaces

This commit is contained in:
Allan Lewis
2016-04-27 11:57:41 +01:00
parent a9cfa61dc3
commit d58e5b1490

View File

@@ -19,28 +19,28 @@ ws.close()
for case in range(1, count+1): for case in range(1, count+1):
url = SERVER + '/runCase?case={0}&agent={1}'.format(case, AGENT) url = SERVER + '/runCase?case={0}&agent={1}'.format(case, AGENT)
status = websocket.STATUS_NORMAL status = websocket.STATUS_NORMAL
try: try:
ws = websocket.create_connection(url) ws = websocket.create_connection(url)
while True: while True:
opcode, msg = ws.recv_data() opcode, msg = ws.recv_data()
if opcode == websocket.ABNF.OPCODE_TEXT: if opcode == websocket.ABNF.OPCODE_TEXT:
msg.decode("utf-8") msg.decode("utf-8")
if opcode in (websocket.ABNF.OPCODE_TEXT, websocket.ABNF.OPCODE_BINARY): if opcode in (websocket.ABNF.OPCODE_TEXT, websocket.ABNF.OPCODE_BINARY):
ws.send(msg, opcode) ws.send(msg, opcode)
except UnicodeDecodeError: except UnicodeDecodeError:
# this case is ok. # this case is ok.
status = websocket.STATUS_PROTOCOL_ERROR status = websocket.STATUS_PROTOCOL_ERROR
except websocket.WebSocketProtocolException: except websocket.WebSocketProtocolException:
status = websocket.STATUS_PROTOCOL_ERROR status = websocket.STATUS_PROTOCOL_ERROR
except websocket.WebSocketPayloadException: except websocket.WebSocketPayloadException:
status = websocket.STATUS_INVALID_PAYLOAD status = websocket.STATUS_INVALID_PAYLOAD
except Exception as e: except Exception as e:
# status = websocket.STATUS_PROTOCOL_ERROR # status = websocket.STATUS_PROTOCOL_ERROR
print(traceback.format_exc()) print(traceback.format_exc())
finally: finally:
ws.close(status) ws.close(status)
print("Ran {} test cases.".format(case)) print("Ran {} test cases.".format(case))
url = SERVER + '/updateReports?agent={0}'.format(AGENT) url = SERVER + '/updateReports?agent={0}'.format(AGENT)