Changeset 8998 for main/waeup.kofa/trunk/src/waeup/kofa
- Timestamp:
- 13 Jul 2012, 11:02:59 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/university/tests/test_batching.py
r8997 r8998 61 61 # Populate university 62 62 self.certificate = createObject('waeup.Certificate') 63 self.certificate.code = 'C ERT1'63 self.certificate.code = 'CRT1' 64 64 self.app['faculties']['FAC1'] = Faculty(code='FAC1') 65 65 self.app['faculties']['FAC1']['DEP1'] = Department(code='DEP1') … … 259 259 class CourseProcessorTests(UniversityProcessorSetup): 260 260 261 #layer = FunctionalLayer262 263 261 def setUp(self): 264 262 super(CourseProcessorTests, self).setUp() … … 310 308 self.assertTrue('CRS1' in self.app['faculties']['FAC1']['DEP1'].courses.keys()) 311 309 self.proc.delEntry(self.row4, self.app) 312 self.assertTrue('CRS' not in self.app['faculties']['FAC1']['DEP1'].courses.keys()) 313 return 314 315 class CertificateProcessorTests(FunctionalTestCase): 316 317 layer = FunctionalLayer 310 self.assertTrue('CRS1' not in self.app['faculties']['FAC1']['DEP1'].courses.keys()) 311 return 312 313 class CertificateProcessorTests(UniversityProcessorSetup): 318 314 319 315 def setUp(self): 320 316 super(CertificateProcessorTests, self).setUp() 321 317 self.proc = CertificateProcessor() 322 self.site0 = dict() 323 self.site1 = dict(faculties=dict()) 324 self.site2 = dict(faculties=dict(FAC=dict())) 325 self.department1 = Department(code='DPT') 326 self.department2 = Department(code='DPT') 327 self.certificate = Certificate(code='CRT') 328 self.department2.certificates['CRT'] = self.certificate 329 self.site3 = dict(faculties=dict(FAC=dict(DPT=self.department1))) 330 self.site4 = dict(faculties=dict(FAC=dict(DPT=self.department2))) 331 self.row = dict(department_code='DPT', faculty_code='FAC', code="CRT") 318 self.row1 = dict(department_code='DEP2', faculty_code='FAC1', code="CRT1") 319 self.row2 = dict(department_code='DEP1', faculty_code='FAC2', code="CRT1") 320 self.row3 = dict(department_code='DEP1', faculty_code='FAC1', code="CRT2") 321 self.row4 = dict(department_code='DEP1', faculty_code='FAC1', code="CRT1") 332 322 return 333 323 334 324 def test_ifaces(self): 335 325 # Make sure we fullfill all interface contracts 336 verifyClass(IBatchProcessor, C ertificateProcessor)326 verifyClass(IBatchProcessor, CourseProcessor) 337 327 verifyObject(IBatchProcessor, self.proc) 338 328 return 339 329 340 330 def test_parents_exist(self): 341 # make sure we can find all certificate parents 342 result0 = self.proc.parentsExist(self.row, self.site0) 343 result1 = self.proc.parentsExist(self.row, self.site1) 344 result2 = self.proc.parentsExist(self.row, self.site2) 345 result3 = self.proc.parentsExist(self.row, self.site3) 346 result4 = self.proc.parentsExist(self.row, self.site4) 347 self.assertTrue(result0 is False) 331 # make sure we lookup parents correctly 332 result1 = self.proc.parentsExist(self.row1, self.app) 333 result2 = self.proc.parentsExist(self.row2, self.app) 334 result3 = self.proc.parentsExist(self.row3, self.app) 348 335 self.assertTrue(result1 is False) 349 336 self.assertTrue(result2 is False) 350 337 self.assertTrue(result3 is True) 351 self.assertTrue(result4 is True)352 338 return 353 339 354 340 def test_entry_exists(self): 355 341 # make sure we find an entry if it exists 356 result0 = self.proc.entryExists(self.row, self.site0) 357 result1 = self.proc.entryExists(self.row, self.site1) 358 result2 = self.proc.entryExists(self.row, self.site2) 359 result3 = self.proc.entryExists(self.row, self.site3) 360 result4 = self.proc.entryExists(self.row, self.site4) 361 self.assertTrue(result0 is False) 342 result1 = self.proc.entryExists(self.row1, self.app) 343 result2 = self.proc.entryExists(self.row2, self.app) 344 result3 = self.proc.entryExists(self.row3, self.app) 345 result4 = self.proc.entryExists(self.row4, self.app) 362 346 self.assertTrue(result1 is False) 363 347 self.assertTrue(result2 is False) … … 368 352 def test_get_entry(self): 369 353 # make sure we can get an entry if it exists 370 result1 = self.proc.getEntry(self.row , self.site3)371 result2 = self.proc.getEntry(self.row , self.site4)354 result1 = self.proc.getEntry(self.row1, self.app) 355 result2 = self.proc.getEntry(self.row4, self.app) 372 356 self.assertTrue(result1 is None) 373 357 self.assertTrue(result2 is self.certificate) … … 376 360 def test_del_entry(self): 377 361 # make sure we can delete entries 378 self.assertTrue('CRT' in self.department2.certificates.keys()) 379 self.proc.delEntry(self.row, self.site4) 380 self.assertTrue('CRT' not in self.department2.certificates.keys()) 381 return 362 self.assertTrue('CRT1' in self.app['faculties']['FAC1']['DEP1'].certificates.keys()) 363 self.proc.delEntry(self.row4, self.app) 364 self.assertTrue('CRT1' not in self.app['faculties']['FAC1']['DEP1'].certificates.keys()) 365 return 366 382 367 383 368 class CertCourseProcessorTests(FunctionalTestCase):
Note: See TracChangeset for help on using the changeset viewer.