1818from . import ws_client as ws_client_module
1919from .ws_client import get_websocket_url , WSClient , V5_CHANNEL_PROTOCOL , V4_CHANNEL_PROTOCOL , CLOSE_CHANNEL , STDIN_CHANNEL , STDOUT_CHANNEL
2020from .ws_client import websocket_proxycare
21- from .ws_client import STDOUT_CHANNEL
2221from kubernetes .client .configuration import Configuration
2322import os
2423import select
@@ -327,7 +326,6 @@ def test_update_receives_close_v5(self):
327326 mock_ws = MagicMock ()
328327 mock_ws .subprotocol = V5_CHANNEL_PROTOCOL
329328 mock_ws .connected = True
330- mock_ws .is_ssl .return_value = False
331329 mock_ws .sock .fileno .return_value = 10
332330
333331 # Setup frame with close signal for channel 0
@@ -353,7 +351,6 @@ def test_update_ignores_close_signal_v4(self):
353351 mock_ws = MagicMock ()
354352 mock_ws .subprotocol = V4_CHANNEL_PROTOCOL
355353 mock_ws .connected = True
356- mock_ws .is_ssl .return_value = False
357354 mock_ws .sock .fileno .return_value = 10
358355
359356 # Setup frame that looks like close signal but should be treated as data
@@ -457,7 +454,6 @@ def test_peek_channel_closed_with_leftover_data(self):
457454 mock_ws = MagicMock ()
458455 mock_ws .subprotocol = V5_CHANNEL_PROTOCOL
459456 mock_ws .connected = True
460- mock_ws .is_ssl .return_value = False
461457 mock_ws .sock .fileno .return_value = 10
462458 mock_create .return_value = mock_ws
463459
@@ -493,7 +489,6 @@ def test_update_infinite_timeout_polls_without_overflow(self):
493489 mock_ws = MagicMock ()
494490 mock_ws .subprotocol = V5_CHANNEL_PROTOCOL
495491 mock_ws .connected = True
496- mock_ws .is_ssl .return_value = False
497492 mock_ws .sock .fileno .return_value = 10
498493 mock_create .return_value = mock_ws
499494
@@ -502,46 +497,6 @@ def test_update_infinite_timeout_polls_without_overflow(self):
502497
503498 mock_poll .return_value .poll .assert_called_once_with (None )
504499
505- def test_update_reads_pending_ssl_data_without_polling (self ):
506- with (
507- patch .object (
508- ws_client_module ,
509- 'create_websocket' ,
510- ) as mock_create ,
511- patch ('select.poll' ) as mock_poll ,
512- patch ('select.select' ) as mock_select ,
513- ):
514- mock_ws = MagicMock ()
515- mock_ws .subprotocol = V5_CHANNEL_PROTOCOL
516- mock_ws .connected = True
517- mock_ws .is_ssl .return_value = True
518- mock_ws .sock .pending .return_value = 1
519-
520- frame = MagicMock ()
521- frame .data = bytes ([STDOUT_CHANNEL ]) + b"pending"
522- mock_ws .recv_data_frame .return_value = (
523- websocket .ABNF .OPCODE_BINARY ,
524- frame ,
525- )
526- mock_create .return_value = mock_ws
527-
528- client = WSClient (
529- self .config_mock ,
530- "wss://test" ,
531- headers = None ,
532- capture_all = True ,
533- binary = True ,
534- )
535- client .update (timeout = None )
536-
537- mock_poll .assert_not_called ()
538- mock_select .assert_not_called ()
539- mock_ws .recv_data_frame .assert_called_once_with (True )
540- self .assertEqual (
541- client .read_channel (STDOUT_CHANNEL ),
542- b"pending" ,
543- )
544-
545500 def test_readline_channel_returns_empty_string_on_expired_timeout (self ):
546501 """Verify readline_channel returns '' (not None) when a finite timeout expires"""
547502 with patch .object (ws_client_module , 'create_websocket' ) as mock_create :
0 commit comments