Changeset 8700 for main/waeup.kofa/trunk/src/waeup
- Timestamp:
- 12 Jun 2012, 21:01:17 (13 years ago)
- Location:
- main/waeup.kofa/trunk/src/waeup/kofa
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_catalog.py
r7811 r8700 21 21 import shutil 22 22 import tempfile 23 import grok 24 from zope.component import getUtility, createObject 23 25 from hurry.query import Eq 24 26 from hurry.query.interfaces import IQuery … … 86 88 self.assertTrue(isinstance(result_applicant, Applicant)) 87 89 self.assertEqual(result_applicant.applicant_id, self.applicant.applicant_id) 90 91 def test_get_payment(self): 92 self.create_applicant() 93 q = getUtility(IQuery) 94 subquery = Eq(('applicants_catalog', 'applicant_id'), 95 self.applicant.applicant_id) 96 results = list(q.searchResults(subquery)) 97 self.assertEqual(len(results), 1) 98 result_applicant = results[0] 99 payment = createObject('waeup.ApplicantOnlinePayment') 100 payment.p_id = 'p1234567890' 101 payment.p_item = u'Payment Item' 102 payment.p_session = 2011 103 payment.p_category = 'application' 104 result_applicant[payment.p_id] = payment 105 # We can find a payment ticket by the payment session ... 106 cat = getUtility(ICatalog, name='payments_catalog') 107 results = cat.searchResults(p_session=(2011, 2011)) 108 results = [x for x in results] # Turn results generator into list 109 assert len(results) == 1 110 assert results[0] is result_applicant['p1234567890'] 111 # ... and by the payment id 112 results = cat.searchResults(p_id=('p1234567890', 'p1234567890')) 113 assert len(results) == 1 114 # If we remove the applicant also the payment disappears 115 del self.app['applicants']['mystuff'][result_applicant.application_number] 116 results = cat.searchResults(p_id=('p1234567890', 'p1234567890')) 117 assert len(results) == 0 -
main/waeup.kofa/trunk/src/waeup/kofa/students/catalog.py
r8404 r8700 26 26 from waeup.kofa.interfaces import ( 27 27 IUniversity, IQueryResultItem, academic_sessions_vocab) 28 from waeup.kofa.students.interfaces import (IStudent, ICourseTicket, 29 IStudentOnlinePayment) 28 from waeup.kofa.students.interfaces import IStudent, ICourseTicket 30 29 from waeup.kofa.university.vocabularies import course_levels 31 30 … … 129 128 session = index.Field(attribute='getLevelSession') 130 129 code = index.Field(attribute='code') 131 132 class StudentPaymentIndexes(grok.Indexes):133 """A catalog for payments.134 """135 grok.site(IUniversity)136 grok.name('payments_catalog')137 grok.context(IStudentOnlinePayment)138 139 p_session = index.Field(attribute='p_session')140 p_category = index.Field(attribute='p_category')141 p_item = index.Field(attribute='p_item')142 p_state = index.Field(attribute='p_state')
Note: See TracChangeset for help on using the changeset viewer.