Files
web2py/gluon/tests/test_contribs.py
T
niphlod 34a417cfa0 fix for StorageList and tests added
gluon/storage.py
StorageList had a recursion error (please check the implementation before committing)

gluon/tests*
added the fix_path module to avoid those ugly lines at the beginning of each test file
added tests for gluon.contenttype and test_fileutils
added tests for missing Storage methods
2014-09-21 08:26:38 +02:00

41 lines
965 B
Python

#!/usr/bin/env python
# -*- coding: utf-8 -*-
""" Unit tests for contribs """
import unittest
from fix_path import fix_sys_path
fix_sys_path(__file__)
from utils import md5_hash
import contrib.fpdf as fpdf
import contrib.pyfpdf as pyfpdf
class TestContribs(unittest.TestCase):
""" Tests the contrib package """
def test_fpdf(self):
""" Basic PDF test and sanity checks """
self.assertEqual(
fpdf.FPDF_VERSION, pyfpdf.FPDF_VERSION, 'version mistmatch')
self.assertEqual(fpdf.FPDF, pyfpdf.FPDF, 'class mistmatch')
pdf = fpdf.FPDF()
pdf.add_page()
pdf.compress = False
pdf.set_font('Arial', '', 14)
pdf.ln(10)
pdf.write(5, 'hello world')
pdf_out = pdf.output('', 'S')
self.assertTrue(fpdf.FPDF_VERSION in pdf_out, 'version string')
self.assertTrue('hello world' in pdf_out, 'sample message')
if __name__ == '__main__':
unittest.main()