Changeset 8968
- Timestamp:
- 10 Jul 2012, 09:26:36 (12 years ago)
- Location:
- main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/interfaces.py
r8966 r8968 17 17 ## 18 18 from zope import schema 19 from zope.interface import Attribute 19 20 from waeup.kofa.schema import TextLineChoice 20 21 from waeup.kofa.interfaces import SimpleKofaVocabulary, academic_sessions_vocab … … 62 63 """ 63 64 65 is_foreigner = Attribute('True if student is non-Nigerian') 66 64 67 marit_stat = schema.Choice( 65 68 title = u'Maritual Status', -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/student.py
r8863 r8968 33 33 grok.provides(INigeriaStudent) 34 34 35 @property 36 def is_foreigner(self): 37 return getattr(self, 'nationality') != 'NG' 35 38 36 39 # Set all attributes of Student required in IStudent as field -
main/kofacustom.nigeria/trunk/src/kofacustom/nigeria/students/tests/test_student.py
r8863 r8968 21 21 from zope.component.interfaces import IFactory 22 22 from zope.interface import verify 23 from zope.schema.interfaces import ConstraintNotSatisfied 23 24 from waeup.kofa.testing import FunctionalTestCase 24 25 from kofacustom.nigeria.students.student import NigeriaStudent, NigeriaStudentFactory … … 57 58 implemented_by = self.factory.getInterfaces() 58 59 assert implemented_by.isOrExtends(INigeriaStudent) 60 61 def test_is_foreigner(self): 62 student = self.factory() 63 self.assertRaises( 64 ConstraintNotSatisfied, setattr, student, 'nationality', 'XX') 65 student.nationality = 'NG' 66 self.assertFalse(student.is_foreigner) 67 student.nationality = 'DE' 68 self.assertTrue(student.is_foreigner) 59 69 60 70 class NigeriaStudentStudyCourseFactoryTest(FunctionalTestCase):
Note: See TracChangeset for help on using the changeset viewer.