Last active
April 5, 2017 10:15
-
-
Save hgenru/47ad817a199de2e33333 to your computer and use it in GitHub Desktop.
Tornado testing 4.0.1 WTF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tornado.web import RequestHandler | |
class HelloHandler(RequestHandler): | |
def get(self): | |
self.write('Hello world!') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from tornado.testing import AsyncHTTPTestCase, gen_test | |
from tornado.web import Application | |
from hello import HelloHandler | |
class HelloHandlerTest(AsyncHTTPTestCase): | |
def get_app(self): | |
return Application( | |
[(r'/', HelloHandler)] | |
) | |
@gen_test | |
def test_response(self): | |
res = self.fetch('/') | |
assert res.error is None, 'error: %s' % str(res.error) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment