Created
September 9, 2016 09:36
-
-
Save bwangelme/286c55472d8642b741ae6dba62bb8b09 to your computer and use it in GitHub Desktop.
tornado单元测试
This file contains 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
import tornado.testing | |
from tornado.testing import AsyncTestCase | |
from tornado.testing import AsyncHTTPClient | |
from tornado.testing import unittest | |
class MyTestCase(AsyncTestCase): | |
@tornado.testing.gen_test | |
def test_http_fetch(self): | |
client = AsyncHTTPClient(self.io_loop) | |
response = yield client.fetch("http://www.tornadoweb.org") | |
self.assertIn(b"FriendFeed", response.body) | |
if __name__ == '__main__': | |
unittest.main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
from tornado.testing import AsyncHTTPClient 错了,应该是from tornado.httpclient import AsyncHTTPClient