def load(self): start_time = time.time() self.content = ( header + "Tahoe-LAFS: {}\n".format(self.core.tahoe_version) + "Datetime: {}\n\n\n".format(datetime.utcnow().isoformat()) + warning_text + "\n----- Beginning of {} debug log -----\n".format(APP_NAME) + '\n'.join(self.core.log_deque) + "\n----- End of {} debug log -----\n".format(APP_NAME)) filters = get_filters(self.core) self.filtered_content = apply_filters(self.content, filters) for i, gateway in enumerate(self.core.gui.main_window.gateways): gateway_id = str(i + 1) gateway_mask = get_mask(gateway.name, 'GatewayName', gateway_id) self.content = self.content + ( '\n----- Beginning of Tahoe-LAFS log for {0} -----\n{1}' '\n----- End of Tahoe-LAFS log for {0} -----\n'.format( gateway.name, gateway.get_log())) self.filtered_content = self.filtered_content + ( '\n----- Beginning of Tahoe-LAFS log for {0} -----\n{1}' '\n----- End of Tahoe-LAFS log for {0} -----\n'.format( gateway_mask, gateway.get_log(apply_filter=True, identifier=gateway_id))) self.done.emit() logging.debug("Loaded logs in %f seconds", time.time() - start_time)
def test_apply_filters_string_not_in_result(core, string): filters = get_filters(core) in_str = "Bob gave {} to Alice".format(string) result = apply_filters(in_str, filters) assert string not in result
def test_apply_filters_filtered_string_in_result(core, string, filtered): filters = get_filters(core) in_str = "Bob gave {} to Alice".format(string) result = apply_filters(in_str, filters) assert "<Filtered:{}>".format(filtered) in result