Skip to content

Commit b9b269c

Browse files
committed
Add unit test for token file with tab
1 parent da13094 commit b9b269c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/test_token_plugins.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,21 @@ def test_simple(self):
3737
self.assertEqual(result[0], "remote_host")
3838
self.assertEqual(result[1], "remote_port")
3939

40+
patch('os.path.isdir', MagicMock(return_value=False))
41+
def test_tabs(self):
42+
plugin = ReadOnlyTokenFile('configfile')
43+
44+
config = "testhost:\tremote_host:remote_port"
45+
pyopen = mock_open(read_data=config)
46+
47+
with patch("websockify.token_plugins.open", pyopen):
48+
result = plugin.lookup('testhost')
49+
50+
pyopen.assert_called_once_with('configfile')
51+
self.assertIsNotNone(result)
52+
self.assertEqual(result[0], "remote_host")
53+
self.assertEqual(result[1], "remote_port")
54+
4055
class JWSTokenTestCase(unittest.TestCase):
4156
def test_asymmetric_jws_token_plugin(self):
4257
plugin = JWTTokenApi("./tests/fixtures/public.pem")

0 commit comments

Comments
 (0)