Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. import pytest
  2. import tornado
  3. from tornado.testing import AsyncTestCase
  4. from tornado.httpclient import AsyncHTTPClient
  5. from tornado.web import Application, RequestHandler
  6. import urllib.parse
  7. from handlers.authentication.restAuthHandlers import RESTAuthHandler
  8. import app
  9.  
  10.  
  11.  
  12. class TestRESTAuthHandler(AsyncTestCase):
  13. def get_app(self):
  14. self.app = Application([('/', RESTAuthHandler)])
  15. return self.app
  16.  
  17. @tornado.testing.gen_test
  18. def test_http_fetch_login(self):
  19. data = urllib.parse.urlencode(dict(username='user', password='123456'))
  20. client = AsyncHTTPClient(self.io_loop)
  21. response = yield client.fetch("http://localhost:8888/web/auth/login", method="POST", body=data)
  22. # Test contents of response
  23. self.assertIn('http test', response.body)
  24.  
  25. E ConnectionRefusedError: [Errno 10061] Unknown error
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement