From 452438dc0757fe2194c78af4b03ac6d2c2ea1ae1 Mon Sep 17 00:00:00 2001 From: Channel Cat Date: Tue, 18 Oct 2016 02:52:35 -0700 Subject: [PATCH] Delete test.py, not needed --- test.py | 52 ---------------------------------------------------- 1 file changed, 52 deletions(-) delete mode 100644 test.py diff --git a/test.py b/test.py deleted file mode 100644 index 263aeae3..00000000 --- a/test.py +++ /dev/null @@ -1,52 +0,0 @@ -from multiprocessing import Array, Event, Process -from time import sleep -from ujson import loads as json_loads - -from sanic import Sanic -from sanic.response import json -from sanic.utils import local_request, HOST, PORT - - -# ------------------------------------------------------------ # -# GET -# ------------------------------------------------------------ # - -def test_json(): - app = Sanic('test_json') - - response = Array('c', 50) - @app.route('/') - async def handler(request): - return json({"test": True}) - - stop_event = Event() - async def after_start(*args, **kwargs): - http_response = await local_request('get', '/') - response.value = http_response.text.encode() - stop_event.set() - - def rescue_crew(): - sleep(5) - stop_event.set() - - rescue_process = Process(target=rescue_crew) - rescue_process.start() - - app.serve_multiple({ - 'host': HOST, - 'port': PORT, - 'after_start': after_start, - 'request_handler': app.handle_request, - 'request_max_size': 100000, - }, workers=2, stop_event=stop_event) - - rescue_process.terminate() - - try: - results = json_loads(response.value) - except: - raise ValueError("Expected JSON response but got '{}'".format(response)) - - assert results.get('test') == True - -test_json() \ No newline at end of file