source: main/waeup.uniben/trunk/src/waeup/uniben/applicants/tests/test_applicant.py @ 15956

Last change on this file since 15956 was 8928, checked in by Henrik Bettermann, 12 years ago

Start using components and interfaces in kofacustom.nigeria. Unfortunately, this does not reduce the code in waeup.uniben very much, only because we are still using an old LGAs dictionary.

Move applicants tests into 'tests' package.

  • Property svn:keywords set to Id
File size: 2.7 KB
Line 
1## $Id: test_applicant.py 8928 2012-07-07 09:25:03Z henrik $
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 applicants and related.
19"""
20import grok
21import shutil
22import tempfile
23from StringIO import StringIO
24from zope.component import adapts, queryUtility
25from zope.component.interfaces import IFactory
26from zope.interface import verify, implements
27from zope.location.interfaces import ILocation
28from waeup.kofa.image.interfaces import IKofaImageFile
29from waeup.kofa.imagestorage import DefaultStorage
30from waeup.kofa.interfaces import IFileStoreHandler, IFileStoreNameChooser
31from waeup.kofa.testing import FunctionalTestCase
32from waeup.uniben.applicants.applicant import (
33    CustomApplicant, CustomApplicantFactory,
34    )
35from waeup.uniben.applicants.interfaces import ICustomApplicant
36from waeup.uniben.testing import FunctionalLayer
37
38class CustomApplicantTest(FunctionalTestCase):
39
40    layer = FunctionalLayer
41
42    def setUp(self):
43        super(CustomApplicantTest, self).setUp()
44        self.applicant = CustomApplicant()
45        return
46
47    def tearDown(self):
48        super(CustomApplicantTest, self).tearDown()
49        return
50
51    def test_interfaces(self):
52        verify.verifyClass(ICustomApplicant, CustomApplicant)
53        verify.verifyObject(ICustomApplicant, self.applicant)
54        return
55
56class CustomApplicantFactoryTest(FunctionalTestCase):
57
58    layer = FunctionalLayer
59
60    def setUp(self):
61        super(CustomApplicantFactoryTest, self).setUp()
62        self.factory = CustomApplicantFactory()
63        return
64
65    def tearDown(self):
66        super(CustomApplicantFactoryTest, self).tearDown()
67        return
68
69    def test_interfaces(self):
70        verify.verifyClass(IFactory, CustomApplicantFactory)
71        verify.verifyObject(IFactory, self.factory)
72
73    def test_factory(self):
74        obj = self.factory()
75        assert isinstance(obj, CustomApplicant)
76
77    def test_getInterfaces(self):
78        implemented_by = self.factory.getInterfaces()
79        assert implemented_by.isOrExtends(ICustomApplicant)
Note: See TracBrowser for help on using the repository browser.