webssh/tests/test_main.py

23 lines
624 B
Python
Raw Normal View History

2018-10-23 14:56:18 +00:00
import unittest
from tornado.web import Application
from webssh import handler
2018-10-23 14:56:18 +00:00
from webssh.main import app_listen
class TestMain(unittest.TestCase):
def test_app_listen(self):
app = Application()
app.listen = lambda x, y, **kwargs: 1
2019-01-16 14:58:49 +00:00
handler.redirecting = None
server_settings = dict()
2018-10-23 14:56:18 +00:00
app_listen(app, 80, '127.0.0.1', server_settings)
2019-01-16 14:58:49 +00:00
self.assertFalse(handler.redirecting)
2018-10-23 14:56:18 +00:00
2019-01-16 14:58:49 +00:00
handler.redirecting = None
server_settings = dict(ssl_options='enabled')
app_listen(app, 80, '127.0.0.1', server_settings)
2019-01-16 14:58:49 +00:00
self.assertTrue(handler.redirecting)