def test_add(self): """Add a new character to the rooster.""" char = Character('test', 80, Character.Races.charr, Character.Sex.male, Character.Professions.guardian, {}, None) rooster = Rooster(self.ROOSTER) rooster.add(char) self.assertEqual(len(rooster), 1) return
def test_save_load(self): """Test if saving the rooster actually saves the file.""" char = Character( 'test', 80, Character.Races.charr, Character.Sex.male, Character.Professions.guardian, { Character.Disciplines.armorsmith: 500, Character.Disciplines.weaponsmith: 415 }, Character.Orders.durmand_priori) rooster = Rooster(self.ROOSTER) rooster.add(char) rooster.save() self.assertTrue(os.path.isfile(self.ROOSTER)) # try to load it back new_rooster = Rooster(self.ROOSTER) self.assertEqual(len(new_rooster), 1) self.assertEqual(new_rooster[0].name, 'test') return
def test_save_load(self): """Test if saving the rooster actually saves the file.""" char = Character('test', 80, Character.Races.charr, Character.Sex.male, Character.Professions.guardian, {Character.Disciplines.armorsmith: 500, Character.Disciplines.weaponsmith: 415}, Character.Orders.durmand_priori) rooster = Rooster(self.ROOSTER) rooster.add(char) rooster.save() self.assertTrue(os.path.isfile(self.ROOSTER)) # try to load it back new_rooster = Rooster(self.ROOSTER) self.assertEqual(len(new_rooster), 1) self.assertEqual(new_rooster[0].name, 'test') return
def _demo_rooster(self): """Return a rooster with a couple of characters for group testing.""" rooster = Rooster(self.ROOSTER) thorianar = Character('Thorianar', 80, Character.Races.charr, Character.Sex.male, Character.Professions.guardian, {Character.Disciplines.armorsmith: 500, Character.Disciplines.weaponsmith: 415}, Character.Orders.durmand_priori) buzzkill = Character('Commander Buzzkill', 80, Character.Races.charr, Character.Sex.male, Character.Professions.engineer, {Character.Disciplines.leatherworker: 500, Character.Disciplines.huntsman: 400}, Character.Orders.durmand_priori) sgt_buzzkill = Character('Sgt Buzzkill', 25, Character.Races.human, Character.Sex.female, Character.Professions.warrior, {}, None) rooster.add(thorianar) rooster.add(buzzkill) rooster.add(sgt_buzzkill) rooster.save() return
def _demo_rooster(self): """Return a rooster with a couple of characters for group testing.""" rooster = Rooster(self.ROOSTER) thorianar = self._thorianar() buzzkill = Character( 'Commander Buzzkill', 80, Character.Races.charr, Character.Sex.male, Character.Professions.engineer, { Character.Disciplines.leatherworker: 500, Character.Disciplines.huntsman: 400 }, Character.Orders.durmand_priori) sgt_buzzkill = Character('Sgt Buzzkill', 25, Character.Races.human, Character.Sex.female, Character.Professions.warrior, {}, None) rooster.add(thorianar) rooster.add(buzzkill) rooster.add(sgt_buzzkill) return rooster
#!/usr/bin/env python # -*- encoding: utf-8 -*- from chesttimer.db.rooster import Rooster from chesttimer.db.rooster import Character personal = Rooster('./personal.json') personal.add(Character('Brigadier Buzzkill', level=80, race=Character.Races.charr, sex=Character.Sex.male, profession=Character.Professions.elementalist, disciplines=None, order=None)) personal.add(Character('Warlord Buzzkill', level=4, race=Character.Races.sylvari, sex=Character.Sex.female, profession=Character.Professions.guardian, disciplines=None, order=None)) personal.add(Character('Thorianar', level=80, race=Character.Races.charr, sex=Character.Sex.male, profession=Character.Professions.guardian, disciplines={Character.Disciplines.armorsmith: 500, Character.Disciplines.weaponsmith: 429}, order=Character.Orders.durmand_priori)) personal.add(Character('Commander Buzzkill', level=80, race=Character.Races.charr, sex=Character.Sex.male, profession=Character.Professions.engineer,