def test_command_line_parsed(self): output_file = StringIO() generator = ConsoleOutputGenerator(output_file) class FakePlugin1(object): pass class FakePlugin2(object): pass generator.command_line_parsed([FakePlugin1, FakePlugin2], None) received_output = output_file.getvalue() output_file.close() # Ensure the console output properly listed the available plugins self.assertIn(u'FakePlugin1', received_output) self.assertIn(u'FakePlugin2', received_output)
def test_command_line_parsed(self): output_file = StringIO() generator = ConsoleOutputGenerator(output_file) class FakePlugin1: pass class FakePlugin2: pass generator.command_line_parsed({FakePlugin1, FakePlugin2}, None, []) received_output = output_file.getvalue() output_file.close() # Ensure the console output properly listed the available plugins self.assertIn('FakePlugin1', received_output) self.assertIn('FakePlugin2', received_output)
def test_command_line_parsed(self): output_file = StringIO() generator = ConsoleOutputGenerator(output_file) class FakePlugin1: pass class FakePlugin2: pass generator.command_line_parsed({FakePlugin1, FakePlugin2}, None, []) received_output = output_file.getvalue() output_file.close() # Ensure the console output properly listed the available plugins assert 'FakePlugin1' in received_output assert 'FakePlugin2' in received_output
def test_command_line_parsed(self): # Given a command line used to run sslyze parsed_cmd_line = ParsedCommandLineFactory.create() # Which contained some valid, and some invalid servers assert parsed_cmd_line.invalid_servers assert parsed_cmd_line.servers_to_scans # When generating the console output for this with StringIO() as file_out: console_gen = ConsoleOutputGenerator(file_to=file_out) console_gen.command_line_parsed(parsed_cmd_line) final_output = file_out.getvalue() # It succeeds and the invalid servers were displayed assert final_output for bad_server in parsed_cmd_line.invalid_servers: assert bad_server.server_string in final_output assert bad_server.error_message in final_output