Skip to content

Instantly share code, notes, and snippets.

@hgenru
Last active April 5, 2017 10:15
Show Gist options
  • Save hgenru/47ad817a199de2e33333 to your computer and use it in GitHub Desktop.
Save hgenru/47ad817a199de2e33333 to your computer and use it in GitHub Desktop.
Tornado testing 4.0.1 WTF
from tornado.web import RequestHandler
class HelloHandler(RequestHandler):
def get(self):
self.write('Hello world!')
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