def test_pcap(self): with open(os.path.join(here, "pcaps", self.pcapfile), "rb") as f: reader = httpreplay.reader.PcapReader(f) reader.tcp = httpreplay.s****a.TCPPacketStreamer( reader, self.handlers) output = [self.format(*stream) for stream in reader.process()] assert self.expected_output == output
def test_pcap(self): with open(os.path.join(here, "pcaps", self.pcapfile), "rb") as f: reader = httpreplay.reader.PcapReader(f) reader.tcp = httpreplay.s****a.TCPPacketStreamer(reader, self.handlers) output = [ self.format(*stream) for stream in reader.process() ] assert self.expected_output == output
def test_suite(): errors = 0 for pcap in pcaps: reader = httpreplay.reader.PcapReader(pcap["pcapfile"]) reader.tcp = \ httpreplay.s****a.TCPPacketStreamer(reader, pcap["handlers"]) count = 0 for s, ts, protocol, sent, recv in reader.process(): output = pcap["format"](s, ts, sent, recv) if output not in pcap["output"]: log.critical("Error in unittest output for %s: %s", pcap["pcapfile"], output) errors += 1 count += 1 if pcap.get("output_count") and count != pcap["output_count"]: log.critical( "Incorrect output count determined for %s: %s instead of %s", pcap["pcapfile"], count, pcap["output_count"] ) log.info("Found %d errors.", errors) exit(1 if errors else 0)