Added a fallback PDF routine that uses pdfrw package instead of pdftk utility.

This commit is contained in:
Mark Wolfman
2018-10-17 02:53:11 -05:00
parent 3c3d4be218
commit 3368a435cb
10 changed files with 258 additions and 113 deletions
+9
View File
@@ -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)
+19
View File
@@ -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.')