Changeset 8213 for main/waeup.kofa/trunk
- Timestamp:
- 19 Apr 2012, 12:40:10 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/utils/tests/test_converters.py
r7932 r8213 22 22 import shutil 23 23 import tempfile 24 import unittest 24 25 from zope import schema 25 26 from zope.component import provideUtility … … 29 30 from zope.formlib import form 30 31 from zope.interface import ( 31 Interface, implements, invariant, Invalid, implementedBy )32 Interface, implements, invariant, Invalid, implementedBy, verify) 32 33 33 34 from waeup.kofa.app import University 34 35 from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase 35 36 from waeup.kofa.interfaces import ( 36 SimpleKofaVocabulary, SubjectSource, GradeSource )37 SimpleKofaVocabulary, SubjectSource, GradeSource, IFieldConverter) 37 38 from waeup.kofa.schoolgrades import ResultEntryField 38 39 from waeup.kofa.university import Faculty 39 from waeup.kofa.utils.converters import IObjectConverter 40 from waeup.kofa.utils.converters import ( 41 IObjectConverter, IFieldConverter, DefaultFieldConverter, 42 ListFieldConverter, PhoneNumberFieldConverter, ResultEntryConverter, 43 DefaultObjectConverter) 40 44 from waeup.kofa.utils.helpers import attrs_to_fields 41 45 … … 125 129 return implementedBy(Faculty) 126 130 131 class FieldConverterTests(unittest.TestCase): 132 133 def test_iface(self): 134 # make sure we fullfill interface contracts 135 obj1 = DefaultFieldConverter(None) 136 obj2 = ListFieldConverter(None) 137 obj3 = PhoneNumberFieldConverter(None) 138 obj4 = ResultEntryConverter(None) 139 verify.verifyObject(IFieldConverter, obj1) 140 verify.verifyObject(IFieldConverter, obj2) 141 verify.verifyObject(IFieldConverter, obj3) 142 verify.verifyObject(IFieldConverter, obj4) 143 verify.verifyClass(IFieldConverter, DefaultFieldConverter) 144 verify.verifyClass(IFieldConverter, ListFieldConverter) 145 verify.verifyClass(IFieldConverter, PhoneNumberFieldConverter) 146 verify.verifyClass(IFieldConverter, ResultEntryConverter) 147 return 148 127 149 class ConverterTests(FunctionalTestCase): 128 150 … … 153 175 shutil.rmtree(self.dc_root) 154 176 clearSite() 177 return 178 179 def test_iface(self): 180 # make sure we fullfill interface contracts 181 obj = DefaultObjectConverter(IContact) 182 verify.verifyObject(IObjectConverter, obj) 183 verify.verifyClass(IObjectConverter, DefaultObjectConverter) 155 184 return 156 185
Note: See TracChangeset for help on using the changeset viewer.