Ejemplo n.º 1
0
 def test_private_data(self):
     """Private test data should not return any exceptions."""
     os.chdir(PRIV_DIR)
     priv_files = glob.glob('*.pcap')
     for f in priv_files:
         try:
             p.parse_pcap(f)
         except:
             # tell which file is to blame, re-raise
             print "\nBarfed on: " + f
             raise
Ejemplo n.º 2
0
 def test_known_data_2(self):
     """Tests some more known input/output pairs!"""
     test_pcap = "testdata/test_dump_2.pcap"
     known_output = [ ("Sun, Apr 22,  7:16:14 PM", "http://nostarch.com/", ""),
                     ("Sun, Apr 22,  7:16:15 PM", "http://nostarch.com/", ""),
                     ("Sun, Apr 22,  7:16:16 PM", "http://nostarch.com/legoheavyweapons", ""),
                     ("Sun, Apr 22,  7:16:18 PM", "http://nostarch.com/catalog/manga", ""),
                     ("Sun, Apr 22,  7:16:20 PM", "http://nostarch.com/linearalgebra", "") ]
     self.assertEqual(p.parse_pcap(test_pcap), known_output)
Ejemplo n.º 3
0
 def test_known_data_1(self):
     """Tests some known input/output pairs"""
     test_pcap = "testdata/test_dump_1.pcap"
     known_output = [ ("Sun, Apr 22,  7:11:53 PM", "http://nostarch.com/", ""),
                     ("Sun, Apr 22,  7:11:54 PM", "http://nostarch.com/", ""),
                     ("Sun, Apr 22,  7:11:55 PM", "http://nostarch.com/catalog/security", ""),
                     ("Sun, Apr 22,  7:11:57 PM", "http://nostarch.com/bughunter", ""),
                     ("Sun, Apr 22,  7:12:01 PM", "http://nostarch.com/catalog/security", ""),
                     ("Sun, Apr 22,  7:12:02 PM", "http://nostarch.com/catalog/business", ""),
                     ("Sun, Apr 22,  7:12:04 PM", "http://nostarch.com/google.htm", "") ]
     self.assertEqual(p.parse_pcap(test_pcap), known_output)