added contrib test, thanks Mariano
This commit is contained in:
2
VERSION
2
VERSION
@@ -1 +1 @@
|
||||
Version 2.00.0 (2012-08-23 16:56:22) dev
|
||||
Version 2.00.0 (2012-08-23 18:59:28) dev
|
||||
|
||||
41
gluon/tests/test_contribs.py
Normal file
41
gluon/tests/test_contribs.py
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
""" Unit tests for contribs """
|
||||
|
||||
import sys
|
||||
import os
|
||||
import unittest
|
||||
if os.path.isdir('gluon'):
|
||||
sys.path.append(os.path.realpath('gluon'))
|
||||
else:
|
||||
sys.path.append(os.path.realpath('../'))
|
||||
|
||||
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()
|
||||
Reference in New Issue
Block a user