def test_scans_completed(self): output_file = StringIO() generator = ConsoleOutputGenerator(output_file) scan_time = 1.3 generator.scans_completed(scan_time) received_output = output_file.getvalue() output_file.close() # Ensure the console output displayed the total scan time self.assertIn(str(scan_time), received_output)
def test_scans_completed(self): # Given the time sslyze took to complete all scans scan_time = 1.3 # When generating the console output for this with StringIO() as file_out: console_gen = ConsoleOutputGenerator(file_to=file_out) console_gen.scans_completed(scan_time) final_output = file_out.getvalue() # It succeeds and the total scan time is displayed assert str(scan_time) in final_output