def test_server_connectivity_test_failed(self): # Given a server to scan to which sslyze could not connect error = ConnectionToServerFailedFactory.create() # When generating the console output for this with StringIO() as file_out: console_gen = ConsoleOutputGenerator(file_to=file_out) console_gen.server_connectivity_test_failed(error) final_output = file_out.getvalue() # It succeeds and the connectivity error was displayed assert final_output assert error.error_message in final_output
def test_server_connectivity_test_failed(self): output_file = StringIO() generator = ConsoleOutputGenerator(output_file) failed_scan = ServerConnectivityError(server_info=MockServerConnectivityTester(), error_message='Some érrôr') generator.server_connectivity_test_failed(failed_scan) received_output = output_file.getvalue() output_file.close() # Ensure the console output properly listed the connectivity error with unicode assert 'unicödeéè.com' in received_output assert 'Some érrôr' in received_output assert 'discarding corresponding tasks' in received_output
def test_server_connectivity_test_failed(self): output_file = StringIO() generator = ConsoleOutputGenerator(output_file) failed_scan = ServerConnectivityError(server_info=MockServerConnectivityTester(), error_message='Some érrôr') generator.server_connectivity_test_failed(failed_scan) received_output = output_file.getvalue() output_file.close() # Ensure the console output properly listed the connectivity error with unicode self.assertIn('unicödeéè.com', received_output) self.assertIn('Some érrôr', received_output) self.assertIn('discarding corresponding tasks', received_output)
def test_server_connectivity_test_failed(self): output_file = StringIO() generator = ConsoleOutputGenerator(output_file) failed_scan = FailedServerScan(server_string=u'unicödeéè.com', connection_exception=ServerConnectivityError(error_msg=u'Some érrôr')) generator.server_connectivity_test_failed(failed_scan) received_output = output_file.getvalue() output_file.close() # Ensure the console output properly listed the connectivity error with unicode self.assertIn(u'unicödeéè.com', received_output) self.assertIn(u'Some érrôr', received_output) self.assertIn('discarding corresponding tasks', received_output)
def test_server_connectivity_test_failed(self): output_file = StringIO() generator = ConsoleOutputGenerator(output_file) failed_scan = FailedServerScan( server_string=u'unicödeéè.com', connection_exception=ServerConnectivityError( error_msg=u'Some érrôr')) generator.server_connectivity_test_failed(failed_scan) received_output = output_file.getvalue() output_file.close() # Ensure the console output properly listed the connectivity error with unicode self.assertIn(u'unicödeéè.com', received_output) self.assertIn(u'Some érrôr', received_output) self.assertIn(u'discarding corresponding tasks', received_output)