def do_perform_test(self, caplog, sample, expected, useragent='linuxfirefox40'): thug = ThugAPI() thug.set_useragent(useragent) thug.set_events('click,storage') thug.set_connect_timeout(2) thug.set_delay(500) thug.disable_cert_logging() thug.set_features_logging() thug.log_init(sample) thug.run_local(sample) records = [r.message for r in caplog.records] matches = 0 for e in expected: for record in records: if e in record: matches += 1 assert matches >= len(expected)