[13973] | 1 | ## $Id: test_refereereport.py 13975 2016-06-22 16:55:37Z henrik $ |
---|
[13972] | 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 | """Tests for application payments. |
---|
| 19 | |
---|
| 20 | """ |
---|
| 21 | import unittest |
---|
[13975] | 22 | from datetime import datetime |
---|
[13972] | 23 | from zope.interface import verify |
---|
| 24 | from zope.component import createObject |
---|
| 25 | from waeup.kofa.applicants.refereereport import ( |
---|
| 26 | ApplicantRefereeReport, ApplicantRefereeReportFactory) |
---|
| 27 | from waeup.kofa.applicants.interfaces import IApplicantRefereeReport |
---|
| 28 | from waeup.kofa.testing import (FunctionalLayer, FunctionalTestCase) |
---|
| 29 | |
---|
| 30 | |
---|
| 31 | class ApplicantRefereeReportTest(FunctionalTestCase): |
---|
| 32 | |
---|
| 33 | layer = FunctionalLayer |
---|
| 34 | |
---|
| 35 | def setUp(self): |
---|
| 36 | super(ApplicantRefereeReportTest, self).setUp() |
---|
| 37 | self.report = createObject(u'waeup.ApplicantRefereeReport') |
---|
| 38 | self.report.r_id = 'my_report' |
---|
| 39 | self.applicant = createObject(u'waeup.Applicant') |
---|
| 40 | self.applicant[self.report.r_id] = self.report |
---|
| 41 | return |
---|
| 42 | |
---|
| 43 | def tearDown(self): |
---|
| 44 | super(ApplicantRefereeReportTest, self).tearDown() |
---|
| 45 | return |
---|
| 46 | |
---|
| 47 | def test_interfaces(self): |
---|
| 48 | # Make sure the correct interfaces are implemented. |
---|
| 49 | self.assertTrue( |
---|
| 50 | verify.verifyClass( |
---|
| 51 | IApplicantRefereeReport, ApplicantRefereeReport) |
---|
| 52 | ) |
---|
| 53 | self.assertTrue( |
---|
| 54 | verify.verifyObject( |
---|
| 55 | IApplicantRefereeReport, ApplicantRefereeReport()) |
---|
| 56 | ) |
---|
| 57 | return |
---|
| 58 | |
---|
| 59 | def test_report(self): |
---|
| 60 | self.assertEqual(self.applicant['my_report'], self.report) |
---|
[13975] | 61 | self.assertTrue(isinstance(self.report.creation_date, datetime)) |
---|
[13972] | 62 | return |
---|
| 63 | |
---|
| 64 | |
---|
| 65 | class ApplicantRefereeReportFactoryTest(unittest.TestCase): |
---|
| 66 | |
---|
| 67 | def setUp(self): |
---|
| 68 | self.factory = ApplicantRefereeReportFactory() |
---|
| 69 | return |
---|
| 70 | |
---|
| 71 | def test_factory(self): |
---|
| 72 | obj = self.factory() |
---|
| 73 | assert isinstance(obj, ApplicantRefereeReport) |
---|
| 74 | |
---|
| 75 | def test_getInterfaces(self): |
---|
| 76 | implemented_by = self.factory.getInterfaces() |
---|
| 77 | assert implemented_by.isOrExtends(IApplicantRefereeReport) |
---|