class MainTests(unittest.TestCase):

    def setUp(self):
        self.lm = LeagueModel()
        self.lm.add_league("Test League")
        self.cl = self.lm.get_current_league()
        self.fm = FilerModule()
        self.lm.set_abilities_file(self.fm.read_file("..\Abilities.txt"))

    def test_01(self):
        print("Test 01 - Add Leader with incorrect health")
        self.cl.add_character("Bruce", char_type="Leader", health="d8",
                              brawl="3d10", shoot="2d10", dodge="3d8",
                              might="3d10", finesse="2d10", cunning="3d8",
                              arg1="Mighty", arg2="Brash", arg3="Crafty")

        self.assertTrue(self.cl.find_character("Bruce") == None)

    def test_02(self):
        print("Test 02 - Add Leader with - incorrect dice type")
        self.cl.add_character("Bruce", char_type="Leader", health="d10",
                              brawl="3d8", shoot="2d10", dodge="3d8",
                              might="3d10", finesse="2d10", cunning="3d8",
                              arg1="Mighty", arg2="Brash", arg3="Crafty")

        self.assertTrue(self.cl.find_character("Bruce") == None)
 def setUp(self):
     self.lm = LeagueModel()
     self.lm.add_league("Test League")
     self.cl = self.lm.get_current_league()
     self.fm = FilerModule()
     self.lm.set_abilities_file(self.fm.read_file("..\Abilities.txt"))
     self.cl.add_character("Bruce", "Leader", "d10", "3d10", "3d10", "3d8",
                           "3d10", "2d8", "2d10", arg1="Mighty",
                           arg2="Brash", arg3="Crafty")
 def setUp(self):
     self.lm = LeagueModel()
     self.lm.add_league("Test League")
     self.cl = self.lm.get_current_league()
     self.fm = FilerModule()
     self.lm.set_abilities_file(self.fm.read_file("..\Abilities.txt"))
     self.cl.add_character("Bruce", "Leader", "d10", "3d10", "3d10", "3d8",
                           "3d10", "2d8", "2d10", arg1="Mighty",
                           arg2="Brash", arg3="Crafty")
     self.cl.add_character("TestFollower", char_type="Follower",
                           health="d6",
                           brawl="1d6", shoot="1d6", dodge="1d6",
                           might="1d6", finesse="1d6", cunning="1d6",
                           arg1="Mighty", arg2="", arg3="")
class MainTests(unittest.TestCase):

    def setUp(self):
        self.lm = LeagueModel()
        self.lm.add_league("Test League")
        self.cl = self.lm.get_current_league()
        self.fm = FilerModule()
        self.lm.set_abilities_file(self.fm.read_file("..\Abilities.txt"))
        self.cl.add_character("Bruce", "Leader", "d10", "3d10", "3d10", "3d8",
                              "3d10", "2d8", "2d10", arg1="Mighty",
                              arg2="Brash", arg3="Crafty")
        self.cl.add_character("TestFollower", char_type="Follower",
                              health="d6",
                              brawl="1d6", shoot="1d6", dodge="1d6",
                              might="1d6", finesse="1d6", cunning="1d6",
                              arg1="Mighty", arg2="", arg3="")

    def test_01(self):
        print('Test 01 - Delete a character')
        theCharacter = self.cl.find_character("TestFollower")
        self.cl.remove_character(theCharacter)
        self.assertTrue(self.cl.find_character("TestFollower") == None)
class MainTests(unittest.TestCase):

    def setUp(self):
        self.lm = LeagueModel()
        self.lm.add_league("Test League")
        self.cl = self.lm.get_current_league()
        self.fm = FilerModule()
        self.lm.set_abilities_file(self.fm.read_file("..\Abilities.txt"))
        self.cl.add_character("Bruce", "Leader", "d10", "3d10", "3d10",
                              "3d8",
                              "3d10", "2d8", "2d10", arg1="Mighty",
                              arg2="Brash", arg3="Crafty")

    def test_01(self):
        print("Test 01 - Add Ally with incorrect health")
        self.cl.add_character("Ally01", char_type="Ally", health="d10",
                              brawl="2d6", shoot="2d6", dodge="1d6",
                              might="1d6", finesse="1d6", cunning="1d6",
                              arg1="Mighty", arg2="", arg3="")

        self.assertTrue(self.cl.find_character("Ally01") == None)

    def test_02(self):
        print("Test 02 - Add Ally with - incorrect dice type")
        self.cl.add_character("Ally01", char_type="Ally", health="d6",
                              brawl="2d10", shoot="2d6", dodge="1d6",
                              might="1d6", finesse="1d6", cunning="1d6",
                              arg1="Mighty", arg2="", arg3="")

        self.assertTrue(self.cl.find_character("Ally01") == None)

    def test_03(self):
        print("Test 03 - Add Ally - Happy day")
        self.cl.add_character("Ally01", char_type="Ally", health="d6",
                              brawl="2d6", shoot="2d6", dodge="1d6",
                              might="1d6", finesse="1d6", cunning="1d6",
                              arg1="Mighty", arg2="", arg3="")
        the_character = self.cl.find_character("Ally01")
        self.assertTrue(str(the_character) == "Ally01")
        if the_character is not None:
            self.cl.remove_character(the_character)

    def test_04(self):
        print("Test 04 - Add Ally - Incorrectly Set Skill")
        self.cl.add_character("Ally01", char_type="Ally", health="d6",
                              brawl="1d6", shoot="2d6", dodge="1d6",
                              might="1d6", finesse="1d6", cunning="1d6",
                              arg1="Mighty", arg2="", arg3="")

        self.assertTrue(self.cl.find_character("Ally01") == None)

    def test_05(self):
        print("Test 05 - Add Ally - When there is already an Ally")
        self.cl.add_character("Ally01", char_type="Ally", health="d6",
                              brawl="2d6", shoot="2d6", dodge="1d6",
                              might="1d6", finesse="1d6",
                              cunning="1d6", arg1="Mighty",
                              arg2="", arg3="")

        self.cl.add_character("Ally02", char_type="Ally", health="d6",
                              brawl="2d6", shoot="2d6", dodge="1d6",
                              might="1d6", finesse="1d6",
                              cunning="1d6", arg1="Mighty",
                              arg2="", arg3="")

        self.assertTrue(str(self.cl.find_character("Ally02")) == "Ally02")
        self.cl.delete_character_by_name("Ally01")
        self.cl.delete_character_by_name("Ally02")

    def test_06(self):
        print("Test 06 - Add Ally - when there is a character with " +
              "the same name in the league")
        self.cl.add_character("Ally01", char_type="Ally", health="d6",
                              brawl="2d6", shoot="2d6", dodge="1d6",
                              might="1d6", finesse="1d6",
                              cunning="1d6", arg1="Mighty",
                              arg2="", arg3="")
        self.cl.add_character("Ally01", char_type="Ally", health="d6",
                              brawl="2d6", shoot="2d6", dodge="1d6",
                              might="1d6", finesse="1d6",
                              cunning="1d6", arg1="Mighty",
                              arg2="", arg3="")
        self.cl.delete_character_by_name("Ally01")
        the_character = self.cl.find_character("Ally01")
        self.cl.remove_character(the_character)
        self.assertTrue(self.cl.find_character("Ally01") == None)
import os

path = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
if path not in sys.path:
    sys.path.insert(1, path)
del path
from league import *
from character import *
from league_model import *
from FilerModule.FilerModule import *
from ViewModel.ViewModel import *


lm = LeagueModel()
lm.add_league("Test League")
fm = FilerModule()
lm.set_abilities_file(fm.read_file("..\Abilities.txt"))
vm = ViewModel()

lm.get_current_league().add_character(
    "Bruce",
    char_type="Leader",
    health="d10",
    brawl="3d10",
    shoot="2d10",
    dodge="3d8",
    might="3d10",
    finesse="2d10",
    cunning="3d8",
    arg1="Mighty",
    arg2="Brash",
 def setUp(self):
     self.lm = LeagueModel()
     self.lm.add_league("Test League")
     self.cl = self.lm.get_current_league()
     self.fm = FilerModule()
     self.lm.set_abilities_file(self.fm.read_file("..\Abilities.txt"))
class MainTests(unittest.TestCase):

    def setUp(self):
        self.lm = LeagueModel()
        self.lm.add_league("Test League")
        self.fm = FilerModule()
        self.lm.set_abilities_file(self.fm.read_file("..\Abilities.txt"))

    def test_01(self):
        print("Test 01 - With all slots full can a new character be created")
        self.lm.get_current_league().add_character("Bruce", char_type="Leader",
                                                   health="d10", brawl="3d10",
                                                   shoot="2d10", dodge="3d8",
                                                   might="3d10",
                                                   finesse="2d10",
                                                   cunning="3d8",
                                                   arg1="Mighty", arg2="Brash",
                                                   arg3="Crafty")

        self.lm.get_current_league().add_character("SideKick01",
                                                   char_type="SideKick",
                                                   health="d8", brawl="2d6",
                                                   shoot="3d6", dodge="2d6",
                                                   might="3d8", finesse="2d8",
                                                   cunning="3d8",
                                                   arg1="Mighty",
                                                   arg2="Brash", arg3="")

        self.lm.get_current_league().add_character("Ally01", char_type="Ally",
                                                   health="d6", brawl="2d6",
                                                   shoot="2d6", dodge="1d6",
                                                   might="1d6", finesse="1d6",
                                                   cunning="1d6",
                                                   arg1="Mighty", arg2="",
                                                   arg3="")

        self.lm.get_current_league().add_character("Ally02", char_type="Ally",
                                                   health="d6", brawl="2d6",
                                                   shoot="2d6", dodge="1d6",
                                                   might="1d6", finesse="1d6",
                                                   cunning="1d6",
                                                   arg1="Mighty", arg2="",
                                                   arg3="")

        self.lm.get_current_league().add_character("Ally03", char_type="Ally",
                                                   health="d6", brawl="2d6",
                                                   shoot="2d6", dodge="1d6",
                                                   might="1d6", finesse="1d6",
                                                   cunning="1d6",
                                                   arg1="Mighty", arg2="",
                                                   arg3="")

        self.lm.get_current_league().add_character("Follower01",
                                                   char_type="Follower",
                                                   health="d6", brawl="1d6",
                                                   shoot="1d6", dodge="1d6",
                                                   might="1d6", finesse="1d6",
                                                   cunning="1d6",
                                                   arg1="Mighty", arg2="",
                                                   arg3="")

        self.lm.get_current_league().add_character("Follower02",
                                                   char_type="Follower",
                                                   health="d6",
                                                   brawl="1d6", shoot="1d6",
                                                   dodge="1d6", might="1d6",
                                                   finesse="1d6",
                                                   cunning="1d6",
                                                   arg1="Mighty", arg2="",
                                                   arg3="")

        self.assertTrue(
            self.lm.get_current_league().find_character("Follower02") == None)