test_main.py (624B)
1 import unittest 2 3 from tornado.web import Application 4 from webssh import handler 5 from webssh.main import app_listen 6 7 8 class TestMain(unittest.TestCase): 9 10 def test_app_listen(self): 11 app = Application() 12 app.listen = lambda x, y, **kwargs: 1 13 14 handler.redirecting = None 15 server_settings = dict() 16 app_listen(app, 80, '127.0.0.1', server_settings) 17 self.assertFalse(handler.redirecting) 18 19 handler.redirecting = None 20 server_settings = dict(ssl_options='enabled') 21 app_listen(app, 80, '127.0.0.1', server_settings) 22 self.assertTrue(handler.redirecting)