summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2021-05-03 14:34:07 +0200
committerPierre Ossman <ossman@cendio.se>2021-05-03 14:34:07 +0200
commiteca301c05b5a5ae9b6896128a44fe2b6c7883c4d (patch)
tree50a4f2669fa545639d93a70d85b88ad7edf51edd /tests
parentb9b269c73f51b1cfb3cbaa5e979efa53202d8289 (diff)
downloadwebsockify-eca301c05b5a5ae9b6896128a44fe2b6c7883c4d.tar.gz
Fix patching of open() for Python 3.4
It doesn't handle builtins automatically, so follow the recommendations from that time.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_token_plugins.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/tests/test_token_plugins.py b/tests/test_token_plugins.py
index 9254256..17218bb 100644
--- a/tests/test_token_plugins.py
+++ b/tests/test_token_plugins.py
@@ -16,7 +16,7 @@ class ReadOnlyTokenFileTestCase(unittest.TestCase):
config = ""
pyopen = mock_open(read_data=config)
- with patch("websockify.token_plugins.open", pyopen):
+ with patch("websockify.token_plugins.open", pyopen, create=True):
result = plugin.lookup('testhost')
pyopen.assert_called_once_with('configfile')
@@ -29,7 +29,7 @@ class ReadOnlyTokenFileTestCase(unittest.TestCase):
config = "testhost: remote_host:remote_port"
pyopen = mock_open(read_data=config)
- with patch("websockify.token_plugins.open", pyopen):
+ with patch("websockify.token_plugins.open", pyopen, create=True):
result = plugin.lookup('testhost')
pyopen.assert_called_once_with('configfile')
@@ -44,7 +44,7 @@ class ReadOnlyTokenFileTestCase(unittest.TestCase):
config = "testhost:\tremote_host:remote_port"
pyopen = mock_open(read_data=config)
- with patch("websockify.token_plugins.open", pyopen):
+ with patch("websockify.token_plugins.open", pyopen, create=True):
result = plugin.lookup('testhost')
pyopen.assert_called_once_with('configfile')