Simplify test by removing ThreadPool
This commit is contained in:
parent
e89be59d3e
commit
606bd61d3a
@ -1,7 +1,7 @@
|
|||||||
import re
|
import re
|
||||||
import pytest
|
import pytest
|
||||||
import tornado.web
|
import tornado.web
|
||||||
from concurrent.futures import ThreadPoolExecutor
|
import tornado.gen
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.gen_test
|
@pytest.mark.gen_test
|
||||||
@ -17,10 +17,13 @@ def test_redirects_when_not_logged_in(http_client, base_url):
|
|||||||
|
|
||||||
@pytest.mark.gen_test
|
@pytest.mark.gen_test
|
||||||
def test_login_with_valid_bearer_token(app, monkeypatch, http_client, base_url):
|
def test_login_with_valid_bearer_token(app, monkeypatch, http_client, base_url):
|
||||||
with ThreadPoolExecutor(max_workers=1) as executor:
|
@tornado.gen.coroutine
|
||||||
|
def _validate_login_token(c, t):
|
||||||
|
return True
|
||||||
|
|
||||||
monkeypatch.setattr(
|
monkeypatch.setattr(
|
||||||
"atst.handlers.login.Login._validate_login_token",
|
"atst.handlers.login.Login._validate_login_token",
|
||||||
lambda c,t: executor.submit(lambda: True),
|
_validate_login_token
|
||||||
)
|
)
|
||||||
response = yield http_client.fetch(
|
response = yield http_client.fetch(
|
||||||
base_url + "/login?bearer-token=abc-123",
|
base_url + "/login?bearer-token=abc-123",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user