Changeset 5755 for main/waeup.sirp/trunk/src/waeup/sirp
- Timestamp:
- 13 Feb 2011, 12:07:41 (14 years ago)
- 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 24 24 """ 25 25 import unittest 26 from zc.sourcefactory.browser.source import FactoredTerms 27 from zope.browser.interfaces import ITerms 28 from zope.component import getMultiAdapter 26 29 from zope.interface.verify import verifyClass, verifyObject 30 from zope.publisher.browser import TestRequest 27 31 from waeup.sirp.applicants import interfaces 28 32 from waeup.sirp.applicants.interfaces import ( 29 APPLICATION_CATEGORIES, application_categories_vocab, 33 APPLICATION_CATEGORIES, application_categories_vocab, GenderSource, 30 34 ) 31 35 … … 52 56 return 53 57 58 class 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 54 90 def suite(): 55 91 suite = unittest.TestSuite() 56 92 for testcase in [ 57 93 ApplicationCategoriesTestCase, 94 InterfacesTest, 58 95 ]: 59 96 suite.addTests(unittest.TestLoader().loadTestsFromTestCase(testcase))
Note: See TracChangeset for help on using the changeset viewer.