Changeset 9028 for main/waeup.kofa/trunk/src/waeup/kofa/students/tests
- Timestamp:
- 20 Jul 2012, 08:56:34 (12 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa/students/tests
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_batching.py
r8920 r9028 23 23 import unittest 24 24 import datetime 25 import grok 25 26 from time import time 27 from zope.event import notify 26 28 from zope.component import createObject 27 29 from zope.component.hooks import setSite, clearSite 28 30 from zope.interface.verify import verifyClass, verifyObject 31 from hurry.workflow.interfaces import IWorkflowState 29 32 30 33 from waeup.kofa.app import University … … 178 181 def setup_student(self, student): 179 182 # set predictable values for `student` 180 student.matric_number = u' M123456'183 student.matric_number = u'234' 181 184 student.adm_code = u'my adm code' 182 185 student.clearance_locked = False 183 186 student.clr_code = u'my clr code' 184 187 student.perm_address = u'Studentroad 21\nLagos 123456\n' 185 student.reg_number = u'123456' 186 student.student_id = u'A111111' 188 student.reg_number = u'123' 187 189 student.firstname = u'Anna' 188 190 student.lastname = u'Tester' … … 240 242 241 243 242 class StudentProcessorTest( FunctionalTestCase):244 class StudentProcessorTest(StudentImportExportSetup): 243 245 244 246 layer = FunctionalLayer … … 246 248 def setUp(self): 247 249 super(StudentProcessorTest, self).setUp() 248 # Setup a sample site for each test249 app = University()250 self.dc_root = tempfile.mkdtemp()251 app['datacenter'].setStoragePath(self.dc_root)252 253 # Prepopulate the ZODB...254 self.getRootFolder()['app'] = app255 # we add the site immediately after creation to the256 # ZODB. Catalogs and other local utilities are not setup257 # before that step.258 self.app = self.getRootFolder()['app']259 # Set site here. Some of the following setup code might need260 # to access grok.getSite() and should get our new app then261 setSite(app)262 250 263 251 # Add student with subobjects 264 252 student = Student() 265 student.firstname = u'Anna'266 student.lastname = u'Tester'267 student.reg_number = u'123'268 student.matric_number = u'234'269 253 self.app['students'].addStudent(student) 254 student = self.setup_student(student) 255 notify(grok.ObjectModifiedEvent(student)) 270 256 self.student = self.app['students'][student.student_id] 257 271 258 self.processor = StudentProcessor() 272 259 self.workdir = tempfile.mkdtemp() … … 292 279 open(self.csv_file_duplicates, 'wb').write(STUDENT_SAMPLE_DATA_DUPLICATES) 293 280 294 def tearDown(self):295 super(StudentProcessorTest, self).tearDown()296 shutil.rmtree(self.workdir)297 shutil.rmtree(self.dc_root)298 clearSite()299 return300 301 281 def test_interface(self): 302 282 # Make sure we fulfill the interface contracts. … … 350 330 self.assertEqual(initial_stud_id, new_stud_id) 351 331 return 332 333 def test_checkUpdateRequirements(self): 334 # Make sure that pg students can't be updated with wrong transition. 335 err = self.processor.checkUpdateRequirements(self.student, 336 dict(reg_number='1', state='returning'), self.app) 337 self.assertTrue(err is None) 338 self.certificate.study_mode = 'pg_ft' 339 err = self.processor.checkUpdateRequirements(self.student, 340 dict(reg_number='1', state='returning'), self.app) 341 self.assertEqual(err, 'State not allowed (pg student).') 342 IWorkflowState(self.student).setState('school fee paid') 343 err = self.processor.checkUpdateRequirements(self.student, 344 dict(reg_number='1', transition='reset6'), self.app) 345 self.assertEqual(err, 'Transition not allowed (pg student).') 346 err = self.processor.checkUpdateRequirements(self.student, 347 dict(reg_number='1', transition='register_courses'), self.app) 348 self.assertEqual(err, 'Transition not allowed (pg student).') 349 352 350 353 351 def test_delEntry(self): -
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_export.py
r8983 r9028 48 48 49 49 'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,' 50 'Anna,Tester, M123456,M.,NG,"Studentroad 21\nLagos 123456\n",'51 '+234-123-12345#,123 456,f,A111111,0,,created'50 'Anna,Tester,234,M.,NG,"Studentroad 21\nLagos 123456\n",' 51 '+234-123-12345#,123,f,A111111,0,,created' 52 52 in result 53 53 ) … … 68 68 69 69 'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,' 70 'Anna,Tester, M123456,M.,NG,"Studentroad 21\nLagos 123456\n",'71 '+234-123-12345#,123 456,f,A111111,0,,created'70 'Anna,Tester,234,M.,NG,"Studentroad 21\nLagos 123456\n",' 71 '+234-123-12345#,123,f,A111111,0,,created' 72 72 in result 73 73 ) … … 87 87 88 88 'my adm code,0,my clr code,1981-02-04#,anna@sample.com,,' 89 'Anna,Tester, M123456,M.,NG,"Studentroad 21\nLagos 123456\n",'90 '+234-123-12345#,123 456,f,A111111,0,,created'89 'Anna,Tester,234,M.,NG,"Studentroad 21\nLagos 123456\n",' 90 '+234-123-12345#,123,f,A111111,0,,created' 91 91 in result 92 92 )
Note: See TracChangeset for help on using the changeset viewer.