mirror of
https://github.com/Threnklyn/dungeon-sheets.git
synced 2026-05-19 04:33:26 +02:00
Added a fallback PDF routine that uses pdfrw package instead of pdftk utility.
This commit is contained in:
@@ -153,3 +153,12 @@ class TestCharacter(TestCase):
|
||||
# Try passing an Armor object directly
|
||||
char.wield_shield(Shield)
|
||||
self.assertEqual(char.armor_class, 15)
|
||||
|
||||
def test_speed(self):
|
||||
# Check that the speed pulls from the character's race
|
||||
char = Character(race='halfling')
|
||||
self.assertEqual(char.speed, 25)
|
||||
# Check that a character with no race defaults to 30 feet
|
||||
char = Character()
|
||||
char.race = None
|
||||
self.assertEqual(char.speed, 30)
|
||||
|
||||
@@ -11,3 +11,22 @@ class CharacterFileTestCase(unittest.TestCase):
|
||||
charfile = CHARFILE
|
||||
result = make_sheets.load_character_file(charfile)
|
||||
self.assertEqual(result['strength'], 8)
|
||||
|
||||
|
||||
class PdfOutputTeestCase(unittest.TestCase):
|
||||
basename = 'clara'
|
||||
|
||||
def tearDown(self):
|
||||
temp_files = [f'{self.basename}.pdf']
|
||||
for f in temp_files:
|
||||
if os.path.exists(f):
|
||||
os.remove(f)
|
||||
|
||||
def test_file_created(self):
|
||||
# Check that a file is created once the function is run
|
||||
pdf_name = f'{self.basename}.pdf'
|
||||
# self.assertFalse(os.path.exists(pdf_name), f'{pdf_name} already exists.')
|
||||
char = character.Character(name='Clara')
|
||||
char.saving_throw_proficiencies = ['strength']
|
||||
make_sheets.create_character_pdf(character=char, basename=self.basename)
|
||||
self.assertTrue(os.path.exists(pdf_name), f'{pdf_name} not created.')
|
||||
|
||||
Reference in New Issue
Block a user