def test_dump_file_override(self): capture = PacketCapture(self.net) capture.start_capture("h1") capture.stop_capture() file_name = capture.get_file_name() first_create_time = os.path.getctime(file_name) capture = PacketCapture(self.net) capture.start_capture("h1") capture.stop_capture() second_create_time = os.path.getctime(file_name) self.assertTrue(second_create_time > first_create_time, "pcap is overriden on second run")
def test_dump_file_exists(self): capture = PacketCapture(self.net) capture.start_capture("h1") capture.stop_capture() self.assertTrue(os.path.isfile("/tmp/h1-eth0.pcap"), "pcap file exists")
def test_dump_right_file_name(self): capture = PacketCapture(self.net) capture.start_capture("h1") capture.stop_capture() self.assertEqual(capture.get_file_name(), "/tmp/h1-eth0.pcap", "TCP-Dump uses right file.")