Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pytest
- import tornado
- from tornado.testing import AsyncTestCase
- from tornado.httpclient import AsyncHTTPClient
- from tornado.web import Application, RequestHandler
- import urllib.parse
- from handlers.authentication.restAuthHandlers import RESTAuthHandler
- import app
- class TestRESTAuthHandler(AsyncTestCase):
- def get_app(self):
- self.app = Application([('/', RESTAuthHandler)])
- return self.app
- @tornado.testing.gen_test
- def test_http_fetch_login(self):
- data = urllib.parse.urlencode(dict(username='user', password='123456'))
- client = AsyncHTTPClient(self.io_loop)
- response = yield client.fetch("http://localhost:8888/web/auth/login", method="POST", body=data)
- # Test contents of response
- self.assertIn('http test', response.body)
- E ConnectionRefusedError: [Errno 10061] Unknown error
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement