12345678910111213141516171819 |
- import random
- import unittest
- import ID2TLib.Controller as Ctrl
- import ID2TLib.TestLibrary as Lib
- class GenericTest(unittest.TestCase):
- def generic_test(self, attack_args, sha_checksum, seed=5, cleanup=True, pcap=Lib.test_pcap, flag_write_file=False,
- flag_recalculate_stats=False, flag_print_statistics=False):
- # TODO: move seed to attacks
- random.seed(seed)
- controller = Ctrl.Controller(pcap_file_path=pcap, do_extra_tests=False)
- controller.load_pcap_statistics(flag_write_file, flag_recalculate_stats, flag_print_statistics)
- controller.process_attacks(attack_args)
- self.assertEqual(Lib.get_sha256(controller.pcap_dest_path), sha_checksum)
- if cleanup:
- Lib.clean_up(controller)
|