Fix tests
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
import asyncio
|
||||
import pytest
|
||||
|
||||
from aiohttp import web
|
||||
from aiohttp_security import remember, forget
|
||||
|
||||
|
||||
@pytest.mark.run_loop
|
||||
def test_remember(create_app_and_client):
|
||||
@asyncio.coroutine
|
||||
def test_remember(loop, test_client):
|
||||
|
||||
@asyncio.coroutine
|
||||
def do_remember(request):
|
||||
response = web.Response()
|
||||
yield from remember(request, response, 'Andrew')
|
||||
|
||||
app, client = yield from create_app_and_client()
|
||||
app = web.Application(loop=loop)
|
||||
app.router.add_route('POST', '/', do_remember)
|
||||
client = yield from test_client(app)
|
||||
resp = yield from client.post('/')
|
||||
assert 500 == resp.status
|
||||
assert (('Security subsystem is not initialized, '
|
||||
@@ -23,16 +23,17 @@ def test_remember(create_app_and_client):
|
||||
yield from resp.release()
|
||||
|
||||
|
||||
@pytest.mark.run_loop
|
||||
def test_forget(create_app_and_client):
|
||||
@asyncio.coroutine
|
||||
def test_forget(loop, test_client):
|
||||
|
||||
@asyncio.coroutine
|
||||
def do_forget(request):
|
||||
response = web.Response()
|
||||
yield from forget(request, response)
|
||||
|
||||
app, client = yield from create_app_and_client()
|
||||
app = web.Application(loop=loop)
|
||||
app.router.add_route('POST', '/', do_forget)
|
||||
client = yield from test_client(app)
|
||||
resp = yield from client.post('/')
|
||||
assert 500 == resp.status
|
||||
assert (('Security subsystem is not initialized, '
|
||||
|
||||
Reference in New Issue
Block a user