Ignore:
Timestamp:
13 Jul 2012, 11:02:59 (12 years ago)
Author:
Henrik Bettermann
Message:

Do the same for CertificateProcessorTests?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/university/tests/test_batching.py

    r8997 r8998  
    6161        # Populate university
    6262        self.certificate = createObject('waeup.Certificate')
    63         self.certificate.code = 'CERT1'
     63        self.certificate.code = 'CRT1'
    6464        self.app['faculties']['FAC1'] = Faculty(code='FAC1')
    6565        self.app['faculties']['FAC1']['DEP1'] = Department(code='DEP1')
     
    259259class CourseProcessorTests(UniversityProcessorSetup):
    260260
    261     #layer = FunctionalLayer
    262 
    263261    def setUp(self):
    264262        super(CourseProcessorTests, self).setUp()
     
    310308        self.assertTrue('CRS1' in self.app['faculties']['FAC1']['DEP1'].courses.keys())
    311309        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
     313class CertificateProcessorTests(UniversityProcessorSetup):
    318314
    319315    def setUp(self):
    320316        super(CertificateProcessorTests, self).setUp()
    321317        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")
    332322        return
    333323
    334324    def test_ifaces(self):
    335325        # Make sure we fullfill all interface contracts
    336         verifyClass(IBatchProcessor, CertificateProcessor)
     326        verifyClass(IBatchProcessor, CourseProcessor)
    337327        verifyObject(IBatchProcessor, self.proc)
    338328        return
    339329
    340330    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)
    348335        self.assertTrue(result1 is False)
    349336        self.assertTrue(result2 is False)
    350337        self.assertTrue(result3 is True)
    351         self.assertTrue(result4 is True)
    352338        return
    353339
    354340    def test_entry_exists(self):
    355341        # 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)
    362346        self.assertTrue(result1 is False)
    363347        self.assertTrue(result2 is False)
     
    368352    def test_get_entry(self):
    369353        # 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)
    372356        self.assertTrue(result1 is None)
    373357        self.assertTrue(result2 is self.certificate)
     
    376360    def test_del_entry(self):
    377361        # 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
    382367
    383368class CertCourseProcessorTests(FunctionalTestCase):
Note: See TracChangeset for help on using the changeset viewer.