source: main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_pdf.py @ 7394

Last change on this file since 7394 was 7393, checked in by uli, 13 years ago

Add some tests for PDF generation. Still lacking important parts.

File size: 1.4 KB
Line 
1"""Test PDF components.
2"""
3import unittest
4
5from zope.component import getAdapter
6from zope.interface import verify
7from waeup.sirp.applicants.pdf import IPDF, PDFApplicationSlip
8from waeup.sirp.applicants.tests.test_browser import ApplicantsFullSetup
9from waeup.sirp.interfaces import IPDF
10from waeup.sirp.testing import FunctionalTestCase, FunctionalLayer
11
12class PDFApplicationSlipTests(ApplicantsFullSetup):
13
14    layer = FunctionalLayer
15
16    def test_ifaces(self):
17        # make sure we implement/provide the promised interfaces
18        obj = PDFApplicationSlip(self.applicant)
19        verify.verifyClass(IPDF, PDFApplicationSlip)
20        verify.verifyObject(IPDF, obj)
21        return
22
23    def test_adapter(self):
24        # we can get PDFs by adapter lookup
25        pdfcreator = getAdapter(self.applicant, IPDF, name='application_slip')
26        self.assertTrue(pdfcreator is not None)
27        return
28
29    def test_call(self):
30        # we can generate PDFs from applicants
31        pdfcreator = PDFApplicationSlip(self.applicant)
32        result = pdfcreator()
33        self.assertTrue(result.startswith('%PDF-1.4'))
34        return
35
36    def test_call_with_admission_set(self):
37        # we can generate PDF if admission course is set.
38        # XXX: implement test
39        pass
40
41    def test_call_with_view(self):
42        # we can provide extra info if we have a view
43        # XXX: implement test
44        pass
Note: See TracBrowser for help on using the repository browser.