source: main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/applicants/tests/test_applicant.py @ 17463

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

Add applicants component tests.

  • Property svn:keywords set to Id
File size: 2.7 KB
Line 
1## $Id: test_applicant.py 8927 2012-07-07 09:03:09Z 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 kofacustom.nigeria.applicants.applicant import (
33    NigeriaApplicant, NigeriaApplicantFactory,
34    )
35from kofacustom.nigeria.applicants.interfaces import INigeriaApplicant
36from kofacustom.nigeria.testing import FunctionalLayer
37
38class NigeriaApplicantTest(FunctionalTestCase):
39
40    layer = FunctionalLayer
41
42    def setUp(self):
43        super(NigeriaApplicantTest, self).setUp()
44        self.applicant = NigeriaApplicant()
45        return
46
47    def tearDown(self):
48        super(NigeriaApplicantTest, self).tearDown()
49        return
50
51    def test_interfaces(self):
52        verify.verifyClass(INigeriaApplicant, NigeriaApplicant)
53        verify.verifyObject(INigeriaApplicant, self.applicant)
54        return
55
56class NigeriaApplicantFactoryTest(FunctionalTestCase):
57
58    layer = FunctionalLayer
59
60    def setUp(self):
61        super(NigeriaApplicantFactoryTest, self).setUp()
62        self.factory = NigeriaApplicantFactory()
63        return
64
65    def tearDown(self):
66        super(NigeriaApplicantFactoryTest, self).tearDown()
67        return
68
69    def test_interfaces(self):
70        verify.verifyClass(IFactory, NigeriaApplicantFactory)
71        verify.verifyObject(IFactory, self.factory)
72
73    def test_factory(self):
74        obj = self.factory()
75        assert isinstance(obj, NigeriaApplicant)
76
77    def test_getInterfaces(self):
78        implemented_by = self.factory.getInterfaces()
79        assert implemented_by.isOrExtends(INigeriaApplicant)
Note: See TracBrowser for help on using the repository browser.