1 | ## $Id: test_pdf.py 7811 2012-03-08 19:00:51Z uli $ |
---|
2 | ## |
---|
3 | ## Copyright (C) 2011 Uli Fouquet & Henrik Bettermann |
---|
4 | ## This program is free software; you can redistribute it and/or modify |
---|
5 | ## it under the terms of the GNU General Public License as published by |
---|
6 | ## the Free Software Foundation; either version 2 of the License, or |
---|
7 | ## (at your option) any later version. |
---|
8 | ## |
---|
9 | ## This program is distributed in the hope that it will be useful, |
---|
10 | ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
11 | ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
12 | ## GNU General Public License for more details. |
---|
13 | ## |
---|
14 | ## You should have received a copy of the GNU General Public License |
---|
15 | ## along with this program; if not, write to the Free Software |
---|
16 | ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
17 | ## |
---|
18 | """Test PDF components. |
---|
19 | """ |
---|
20 | import unittest |
---|
21 | |
---|
22 | from zope.component import getAdapter |
---|
23 | from zope.interface import verify |
---|
24 | from waeup.kofa.applicants.pdf import IPDF, PDFApplicationSlip |
---|
25 | from waeup.kofa.applicants.tests.test_browser import ApplicantsFullSetup |
---|
26 | from waeup.kofa.interfaces import IPDF |
---|
27 | from waeup.kofa.testing import FunctionalTestCase, FunctionalLayer |
---|
28 | |
---|
29 | class PDFApplicationSlipTests(ApplicantsFullSetup): |
---|
30 | |
---|
31 | layer = FunctionalLayer |
---|
32 | |
---|
33 | def test_ifaces(self): |
---|
34 | # make sure we implement/provide the promised interfaces |
---|
35 | obj = PDFApplicationSlip(self.applicant) |
---|
36 | verify.verifyClass(IPDF, PDFApplicationSlip) |
---|
37 | verify.verifyObject(IPDF, obj) |
---|
38 | return |
---|
39 | |
---|
40 | def test_adapter(self): |
---|
41 | # we can get PDFs by adapter lookup |
---|
42 | pdfcreator = getAdapter(self.applicant, IPDF, name='application_slip') |
---|
43 | self.assertTrue(pdfcreator is not None) |
---|
44 | return |
---|
45 | |
---|
46 | def test_call(self): |
---|
47 | # we can generate PDFs from applicants |
---|
48 | pdfcreator = PDFApplicationSlip(self.applicant) |
---|
49 | result = pdfcreator() |
---|
50 | self.assertTrue(result.startswith('%PDF-1.4')) |
---|
51 | return |
---|
52 | |
---|
53 | def test_call_with_admission_set(self): |
---|
54 | # we can generate PDF if admission course is set. |
---|
55 | # XXX: implement test |
---|
56 | pass |
---|
57 | |
---|
58 | def test_call_with_view(self): |
---|
59 | # we can provide extra info if we have a view |
---|
60 | # XXX: implement test |
---|
61 | pass |
---|