test_AttackController.py 831 B

123456789101112131415161718192021
  1. import unittest
  2. import Core.AttackController as atkCtrl
  3. class TestAttackController(unittest.TestCase):
  4. def test_choose_attack_correct_name(self):
  5. self.assertEqual(atkCtrl.AttackController.choose_attack("DDoSAttack"), "DDoSAttack")
  6. def test_choose_attack_lower_case(self):
  7. self.assertEqual(atkCtrl.AttackController.choose_attack("ddosattack"), "DDoSAttack")
  8. def test_choose_attack_no_ending(self):
  9. self.assertEqual(atkCtrl.AttackController.choose_attack("DDoS"), "DDoSAttack")
  10. def test_choose_attack_lower_case_no_ending(self):
  11. self.assertEqual(atkCtrl.AttackController.choose_attack("ddos"), "DDoSAttack")
  12. def test_choose_attack_lower_case_invalid_name(self):
  13. with self.assertRaises(SystemExit):
  14. atkCtrl.AttackController.choose_attack("somewrongname")