diff options
author | Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com> | 2016-02-16 11:42:27 -0200 |
---|---|---|
committer | Jose Ricardo Ziviani <joserz@linux.vnet.ibm.com> | 2016-02-16 13:51:13 -0200 |
commit | 7f8baf54e17ddcc3d467f55807b3fdda48ab5910 (patch) | |
tree | 8d32597877a1641418c93da9d228d0b4e16912f6 /tests | |
parent | 0b906a1c3e37074ecc1a2e1c3bf2f9ff84d01f8e (diff) | |
download | websockify-7f8baf54e17ddcc3d467f55807b3fdda48ab5910.tar.gz |
Enable unix socket to work with token plugin
This commit adds support to unix sockets in the token plugin, thus it is
possible to have a token files like:
token: unix_socket:/path/to/socket_file
A single websockify instance will be able to handle multiple sockets.
Signed-off-by: Jose Ricardo Ziviani <jose@ziviani.net>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_websocketproxy.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tests/test_websocketproxy.py b/tests/test_websocketproxy.py index 92fd5db..6e34ac0 100644 --- a/tests/test_websocketproxy.py +++ b/tests/test_websocketproxy.py @@ -93,6 +93,16 @@ class ProxyRequestHandlerTestCase(unittest.TestCase): self.assertEqual(host, "some host") self.assertEqual(port, "some port") + def test_get_target_unix_socket(self): + class TestPlugin(token_plugins.BasePlugin): + def lookup(self, token): + return ("unix_socket", "/tmp/socket") + + _, socket = self.handler.get_target( + TestPlugin(None), self.handler.path) + + self.assertEqual(socket, "/tmp/socket") + def test_get_target_raises_error_on_unknown_token(self): class TestPlugin(token_plugins.BasePlugin): def lookup(self, token): |