3
0

GenericTest.py 747 B

123456789101112131415161718
  1. import random
  2. import unittest
  3. from ID2TLib.Controller import Controller
  4. from Test.Lib import test_pcap, get_sha256, clean_up
  5. class GenericTest(unittest.TestCase):
  6. def generic_test(self, attack_args, sha_checksum, seed=5, cleanup=True, pcap=test_pcap, flag_write_file=False,
  7. flag_recalculate_stats=False, flag_print_statistics=False):
  8. random.seed(seed)
  9. controller = Controller(pcap_file_path=pcap, do_extra_tests=False)
  10. controller.load_pcap_statistics(flag_write_file, flag_recalculate_stats, flag_print_statistics)
  11. controller.process_attacks(attack_args)
  12. self.assertEqual(get_sha256(controller.pcap_dest_path), sha_checksum)
  13. if cleanup:
  14. clean_up(controller)