|
15 | 15 | from unittest import mock |
16 | 16 |
|
17 | 17 | from proxy.proxy import main, entry_point |
18 | | -from proxy.common.constants import _env_threadless_compliant # noqa: WPS450 |
| 18 | +from proxy.common.constants import DEFAULT_PORT_FILE, _env_threadless_compliant # noqa: WPS450 |
19 | 19 | from proxy.common.utils import bytes_ |
20 | 20 |
|
21 | 21 | from proxy.common.constants import DEFAULT_ENABLE_DASHBOARD, DEFAULT_LOCAL_EXECUTOR, DEFAULT_LOG_LEVEL, DEFAULT_LOG_FILE |
@@ -69,6 +69,7 @@ def mock_default_args(mock_args: mock.Mock) -> None: |
69 | 69 | mock_args.enable_dashboard = DEFAULT_ENABLE_DASHBOARD |
70 | 70 | mock_args.work_klass = DEFAULT_WORK_KLASS |
71 | 71 | mock_args.local_executor = int(DEFAULT_LOCAL_EXECUTOR) |
| 72 | + mock_args.port_file = DEFAULT_PORT_FILE |
72 | 73 |
|
73 | 74 | @mock.patch('os.remove') |
74 | 75 | @mock.patch('os.path.exists') |
@@ -96,6 +97,7 @@ def test_entry_point( |
96 | 97 | mock_initialize.return_value.local_executor = 0 |
97 | 98 | mock_initialize.return_value.enable_events = False |
98 | 99 | mock_initialize.return_value.pid_file = pid_file |
| 100 | + mock_initialize.return_value.port_file = None |
99 | 101 | entry_point() |
100 | 102 | mock_event_manager.assert_not_called() |
101 | 103 | mock_listener.assert_called_once_with( |
@@ -143,6 +145,7 @@ def test_main_with_no_flags( |
143 | 145 | mock_sleep.side_effect = KeyboardInterrupt() |
144 | 146 | mock_initialize.return_value.local_executor = 0 |
145 | 147 | mock_initialize.return_value.enable_events = False |
| 148 | + mock_initialize.return_value.port_file = None |
146 | 149 | main() |
147 | 150 | mock_event_manager.assert_not_called() |
148 | 151 | mock_listener.assert_called_once_with( |
@@ -183,6 +186,7 @@ def test_enable_events( |
183 | 186 | mock_sleep.side_effect = KeyboardInterrupt() |
184 | 187 | mock_initialize.return_value.local_executor = 0 |
185 | 188 | mock_initialize.return_value.enable_events = True |
| 189 | + mock_initialize.return_value.port_file = None |
186 | 190 | main() |
187 | 191 | mock_event_manager.assert_called_once() |
188 | 192 | mock_event_manager.return_value.setup.assert_called_once() |
|
0 commit comments