Ignore:
Timestamp:
1 Oct 2012, 15:51:42 (12 years ago)
Author:
uli
Message:

Add helper for catalog tests (we will use this mainly in report tests).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_catalog.py

    r8244 r9264  
    3636    layer = FunctionalLayer
    3737
     38    def create_cert(self, facname, deptname, certname):
     39        # helper: create faculty, dept, and cert
     40        self.app['faculties'][facname] = Faculty(code=facname)
     41        self.app['faculties'][facname][deptname] = Department(code=deptname)
     42        cert = createObject('waeup.Certificate')
     43        cert.code = certname
     44        self.app['faculties'][facname][deptname].certificates.addCertificate(
     45            cert)
     46        return cert
     47
    3848    def setUp(self):
    3949        super(CatalogTestSetup, self).setUp()
     
    4858        self.app = self.getRootFolder()['app']
    4959        setSite(self.app)
    50         self.certificate = createObject('waeup.Certificate')
    51         self.certificate.code = u'CERT1'
    52         self.app['faculties']['fac1'] = Faculty(code=u'fac1')
    53         self.app['faculties']['fac1']['dep1'] = Department(code=u'dep1')
    54         self.app['faculties']['fac1']['dep1'].certificates.addCertificate(
    55             self.certificate)
     60        self.certificate = self.create_cert(u'fac1', u'dep1', u'CERT1')
    5661
    5762        # Create student with subobjects
     
    99104        # We can find a certain student id
    100105        cat = queryUtility(ICatalog, name='students_catalog')
    101         results = cat.searchResults(student_id=(self.student_id, self.student_id))
     106        results = cat.searchResults(student_id=(self.student_id,
     107                                                self.student_id))
    102108        results = [x for x in results] # Turn results generator into list
    103109        assert len(results) == 1
Note: See TracChangeset for help on using the changeset viewer.