#NEWLINE# @ mock . patch ( 'socket.socket.connect_ex' ) #NEWLINE# def test_perform_tcp_healthcheck_failure( mock_socket_connect ) : #NEWLINE# #INDENT# fake_tcp_url = 'tcp://fakehost:1234' #NEWLINE# fake_timeout = 10 #NEWLINE# mock_socket_connect . return_value = 1 #NEWLINE# actual = perform_tcp_healthcheck ( fake_tcp_url , mock_socket_connect ) #NEWLINE# assert ( actual [ 0 ] is False ) #NEWLINE# assert ( 'timeout' in actual [ 1 ] ) #NEWLINE# assert ( '10 seconds' in actual [ 1 ] )