Changeset 6118 for main/waeup.sirp/trunk/src/waeup/sirp/applicants
- Timestamp:
- 16 May 2011, 14:58:30 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_catalog.py
r6117 r6118 26 26 import tempfile 27 27 import unittest 28 from hurry.query import Eq 29 from hurry.query.interfaces import IQuery 28 30 from zope.app.testing.functional import FunctionalTestCase 29 31 from zope.catalog.interfaces import ICatalog … … 33 35 from zope.testbrowser.testing import Browser 34 36 from waeup.sirp.app import University 37 from waeup.sirp.applicants.container import ApplicantsContainer 38 from waeup.sirp.applicants.applicants import Applicant 35 39 from waeup.sirp.testing import FunctionalLayer 36 40 … … 57 61 shutil.rmtree(self.dc_root) 58 62 63 def create_applicant(self): 64 # Create an applicant in an applicants container 65 self.container = ApplicantsContainer() 66 setSite(self.app) 67 self.app['applicants']['mystuff'] = self.container 68 self.applicant = Applicant() 69 self.ac = u'FOO-666-123456789' 70 self.applicant.access_code = self.ac 71 self.app['applicants']['mystuff'][self.ac] = self.applicant 72 return 73 59 74 def test_get_applicants_catalog(self): 60 75 # There is no global applicants catalog, but one for each site. … … 66 81 cat = getUtility(ICatalog, name='applicants_catalog') 67 82 self.assertTrue(ICatalog.providedBy(cat)) 83 84 def test_get_applicant(self): 85 # Make sure that applicants are really catalogued on creation. 86 self.create_applicant() 87 q = getUtility(IQuery) 88 subquery = Eq(('applicants_catalog', 'access_code'), self.ac) 89 results = list(q.searchResults(subquery)) 90 self.assertEqual(len(results), 1) 91 92 result_applicant = results[0] 93 self.assertTrue(isinstance(result_applicant, Applicant)) 94 self.assertEqual(result_applicant.access_code, self.ac)
Note: See TracChangeset for help on using the changeset viewer.