Changeset 5755 for main/waeup.sirp


Ignore:
Timestamp:
13 Feb 2011, 12:07:41 (14 years ago)
Author:
uli
Message:

Move iterface test from jambtables into applicants package.

Location:
main/waeup.sirp/trunk/src/waeup/sirp/applicants
Files:
1 deleted
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_interfaces.py

    r5680 r5755  
    2424"""
    2525import unittest
     26from zc.sourcefactory.browser.source import FactoredTerms
     27from zope.browser.interfaces import ITerms
     28from zope.component import getMultiAdapter
    2629from zope.interface.verify import verifyClass, verifyObject
     30from zope.publisher.browser import TestRequest
    2731from waeup.sirp.applicants import interfaces
    2832from waeup.sirp.applicants.interfaces import (
    29     APPLICATION_CATEGORIES, application_categories_vocab,
     33    APPLICATION_CATEGORIES, application_categories_vocab, GenderSource,
    3034    )
    3135
     
    5256        return
    5357
     58class InterfacesTest(unittest.TestCase):
     59
     60    def setUp(self):
     61        self.source = GenderSource()
     62        self.request = TestRequest()
     63        self.terms = FactoredTerms(self.source, self.request)
     64        return
     65
     66    def tearDown(self):
     67        pass
     68
     69    def test_GenderSource_list(self):
     70        result = list(self.source)
     71        self.assertEqual(result, ['m', 'f'])
     72
     73    def test_GenderSource_term_male(self):
     74        term = self.terms.getTerm('m')
     75        assert term.title == 'male'
     76        assert term.token == 'm'
     77        assert term.value == 'm'
     78
     79    def test_GenderSource_term_female(self):
     80        term = self.terms.getTerm('f')
     81        assert term.title == 'female'
     82        assert term.token == 'f'
     83        assert term.value == 'f'
     84
     85    def test_GernderSource_term_invalid(self):
     86        term_inv = self.terms.getTerm('Invalid')
     87        assert term_inv.title is None
     88        assert term_inv.token == 'i'
     89
    5490def suite():
    5591    suite = unittest.TestSuite()
    5692    for testcase in [
    5793            ApplicationCategoriesTestCase,
     94            InterfacesTest,
    5895            ]:
    5996        suite.addTests(unittest.TestLoader().loadTestsFromTestCase(testcase))
Note: See TracChangeset for help on using the changeset viewer.