Remove utils.py

This commit is contained in:
38elements
2017-05-04 15:52:18 +09:00
parent f611eb2c2b
commit 25037006bf
3 changed files with 6 additions and 37 deletions

View File

@@ -1,16 +1,17 @@
import sanic
from sanic.utils import sanic_endpoint_test
from sanic import Sanic
from sanic.response import text
from threading import Event
import asyncio
def test_create_task():
e = Event()
async def coro():
await asyncio.sleep(0.05)
e.set()
app = sanic.Sanic()
app = Sanic('test_create_task')
app.add_task(coro)
@app.route('/early')
@@ -22,9 +23,8 @@ def test_create_task():
await asyncio.sleep(0.1)
return text(e.is_set())
request, response = sanic_endpoint_test(app, uri='/early')
request, response = app.test_client.get('/early')
assert response.body == b'False'
request, response = sanic_endpoint_test(app, uri='/late')
request, response = app.test_client.get('/late')
assert response.body == b'True'