1 from unittest import TestCase |
1 # copyright 2003-2010 LOGILAB S.A. (Paris, FRANCE), all rights reserved. |
|
2 # contact http://www.logilab.fr/ -- mailto:contact@logilab.fr |
|
3 # |
|
4 # This file is part of CubicWeb. |
|
5 # |
|
6 # CubicWeb is free software: you can redistribute it and/or modify it under the |
|
7 # terms of the GNU Lesser General Public License as published by the Free |
|
8 # Software Foundation, either version 2.1 of the License, or (at your option) |
|
9 # any later version. |
|
10 # |
|
11 # logilab-common is distributed in the hope that it will be useful, but WITHOUT |
|
12 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|
13 # FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
|
14 # details. |
|
15 # |
|
16 # You should have received a copy of the GNU Lesser General Public License along |
|
17 # with CubicWeb. If not, see <http://www.gnu.org/licenses/>. |
2 import os.path as osp |
18 import os.path as osp |
|
19 from tempfile import NamedTemporaryFile |
|
20 from subprocess import Popen as sub |
3 from xml.etree.cElementTree import ElementTree, fromstring, tostring, dump |
21 from xml.etree.cElementTree import ElementTree, fromstring, tostring, dump |
4 |
22 |
5 from tempfile import NamedTemporaryFile |
23 from logilab.common.testlib import TestCase, unittest_main |
6 from subprocess import Popen as sub |
|
7 |
24 |
8 from cubicweb.utils import can_do_pdf_conversion |
25 from cubicweb.utils import can_do_pdf_conversion |
9 |
|
10 from cubicweb.ext.xhtml2fo import ReportTransformer |
26 from cubicweb.ext.xhtml2fo import ReportTransformer |
11 |
27 |
12 DATADIR = osp.join(osp.dirname(__file__), 'data') |
28 DATADIR = osp.join(osp.dirname(__file__), 'data') |
13 |
29 |
14 class PDFTC(TestCase): |
30 class PDFTC(TestCase): |
34 output = pdftmp.read() |
50 output = pdftmp.read() |
35 # XXX almost equals due to ID, creation date, so it seems to fail |
51 # XXX almost equals due to ID, creation date, so it seems to fail |
36 self.assertEquals( len(output), len(reference) ) |
52 self.assertEquals( len(output), len(reference) ) |
37 # cut begin & end 'cause they contain variyng data |
53 # cut begin & end 'cause they contain variyng data |
38 self.assertTextEquals(output[150:1500], reference[150:1500]) |
54 self.assertTextEquals(output[150:1500], reference[150:1500]) |
|
55 |
|
56 if __name__ == '__main__': |
|
57 unittest_main() |
|
58 |