diff options
Diffstat (limited to 'WebKitTools/pywebsocket/test/test_dispatch.py')
-rw-r--r-- | WebKitTools/pywebsocket/test/test_dispatch.py | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/WebKitTools/pywebsocket/test/test_dispatch.py b/WebKitTools/pywebsocket/test/test_dispatch.py index d617205..b19d706 100644 --- a/WebKitTools/pywebsocket/test/test_dispatch.py +++ b/WebKitTools/pywebsocket/test/test_dispatch.py @@ -136,8 +136,7 @@ class DispatcherTest(unittest.TestCase): dispatcher.do_extra_handshake(request) # Must not raise exception. request.ws_origin = 'http://bad.example.com' - self.assertRaises(dispatch.DispatchError, - dispatcher.do_extra_handshake, request) + self.assertRaises(Exception, dispatcher.do_extra_handshake, request) def test_transfer_data(self): dispatcher = dispatch.Dispatcher(_TEST_HANDLERS_DIR, None) @@ -156,6 +155,20 @@ class DispatcherTest(unittest.TestCase): self.assertEqual('sub/plain_wsh.py is called for /sub/plain, None', request.connection.written_data()) + request = mock.MockRequest(connection=mock.MockConn('')) + request.ws_resource = '/sub/plain?' + request.ws_protocol = None + dispatcher.transfer_data(request) + self.assertEqual('sub/plain_wsh.py is called for /sub/plain?, None', + request.connection.written_data()) + + request = mock.MockRequest(connection=mock.MockConn('')) + request.ws_resource = '/sub/plain?q=v' + request.ws_protocol = None + dispatcher.transfer_data(request) + self.assertEqual('sub/plain_wsh.py is called for /sub/plain?q=v, None', + request.connection.written_data()) + def test_transfer_data_no_handler(self): dispatcher = dispatch.Dispatcher(_TEST_HANDLERS_DIR, None) for resource in ['/blank', '/sub/non_callable', @@ -179,10 +192,8 @@ class DispatcherTest(unittest.TestCase): try: dispatcher.transfer_data(request) self.fail() - except dispatch.DispatchError, e: + except Exception, e: self.failUnless(str(e).find('Intentional') != -1) - except Exception: - self.fail() def test_scan_dir(self): disp = dispatch.Dispatcher(_TEST_HANDLERS_DIR, None) |