@@ -177,6 +177,39 @@ def test_enable_dashboard(
177
177
mock_event_manager .return_value .start_event_dispatcher .assert_called_once ()
178
178
mock_event_manager .return_value .stop_event_dispatcher .assert_called_once ()
179
179
180
+ @mock .patch ('time.sleep' )
181
+ @mock .patch ('proxy.proxy.Proxy.load_plugins' )
182
+ @mock .patch ('proxy.common.flag.FlagParser.parse_args' )
183
+ @mock .patch ('proxy.proxy.EventManager' )
184
+ @mock .patch ('proxy.proxy.AcceptorPool' )
185
+ def test_enable_devtools (
186
+ self ,
187
+ mock_acceptor_pool : mock .Mock ,
188
+ mock_event_manager : mock .Mock ,
189
+ mock_parse_args : mock .Mock ,
190
+ mock_load_plugins : mock .Mock ,
191
+ mock_sleep : mock .Mock ,
192
+ ) -> None :
193
+ mock_sleep .side_effect = KeyboardInterrupt ()
194
+ mock_args = mock_parse_args .return_value
195
+ self .mock_default_args (mock_args )
196
+ mock_args .enable_devtools = True
197
+ main (['--enable-devtools' ])
198
+ mock_load_plugins .assert_called ()
199
+ print (mock_load_plugins .call_args_list [0 ][0 ][0 ])
200
+ self .assertEqual (
201
+ mock_load_plugins .call_args_list [0 ][0 ][0 ], [
202
+ b'proxy.http.inspector.DevtoolsProtocolPlugin' ,
203
+ b'proxy.http.server.HttpWebServerPlugin' ,
204
+ b'proxy.http.proxy.HttpProxyPlugin' ,
205
+ ],
206
+ )
207
+ mock_parse_args .assert_called_once ()
208
+ mock_acceptor_pool .assert_called ()
209
+ mock_acceptor_pool .return_value .setup .assert_called ()
210
+ # Currently --enable-devtools alone doesn't enable eventing core
211
+ mock_event_manager .assert_not_called ()
212
+
180
213
@mock .patch ('time.sleep' )
181
214
@mock .patch ('os.remove' )
182
215
@mock .patch ('os.path.exists' )
@@ -284,14 +317,11 @@ def test_main_version(
284
317
mock_print .assert_called_with (__version__ )
285
318
self .assertEqual (e .exception .code , 0 )
286
319
287
- def test_enable_devtools (self ) -> None :
288
- pass
289
-
290
- def test_pac_file (self ) -> None :
291
- pass
320
+ # def test_pac_file(self) -> None:
321
+ # pass
292
322
293
- def test_imports_plugin (self ) -> None :
294
- pass
323
+ # def test_imports_plugin(self) -> None:
324
+ # pass
295
325
296
- def test_cannot_enable_https_proxy_and_tls_interception_mutually (self ) -> None :
297
- pass
326
+ # def test_cannot_enable_https_proxy_and_tls_interception_mutually(self) -> None:
327
+ # pass
0 commit comments