Changeset 16848 for main/waeup.fceokene
- Timestamp:
- 28 Feb 2022, 22:19:59 (3 years ago)
- Location:
- main/waeup.fceokene/trunk/src/waeup/fceokene/applicants
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/browser.py
r15961 r16848 191 191 counter = 0 192 192 for appl in container.values(): 193 if appl.state in (SUBMITTED, ADMITTED, NOT_ADMITTED, CREATED) \ 194 and (appl.school1 == self.context.school1 \ 195 or appl.school1 == data.get('school1')): 196 counter += 1 193 if appl.state in (SUBMITTED, ADMITTED, NOT_ADMITTED, CREATED): 194 if appl.school1 == self.context.school1 \ 195 or appl.school1 == data.get('school1'): 196 counter += 1 197 if appl != self.context \ 198 and (appl.subj_comb == self.context.subj_comb \ 199 or appl.subj_comb == data.get('subj_comb')): 200 return True 197 201 if counter == 10: 198 202 return True -
main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/interfaces.py
r16844 r16848 158 158 title = _(u'Subject Combination'), 159 159 source = AppCatCertificateSource(), 160 required = False,160 required = True, 161 161 ) 162 162 -
main/waeup.fceokene/trunk/src/waeup/fceokene/applicants/tests/test_browser.py
r15635 r16848 21 21 import pytz 22 22 import os 23 import grok 24 from zope.event import notify 23 25 from zope.component.hooks import setSite, clearSite 24 26 from zope.component import createObject … … 94 96 self.tpucontainer.code = u'tpu%s' % session 95 97 self.tpucontainer.prefix = u'tpu' 96 self.tpucontainer.application_category = u' no'98 self.tpucontainer.application_category = u'tpu' 97 99 self.tpucontainer.year = session 98 100 self.tpucontainer.application_fee = 300.0 … … 190 192 191 193 def test_final_submit_tpu(self): 194 self.certificate.application_category = 'tpu' 195 notify(grok.ObjectModifiedEvent(self.certificate)) 192 196 IWorkflowState(self.tpuapplicant).setState('paid') 193 197 self.browser.open(self.login_path) … … 199 203 self.browser.getControl(name="form.email").value = 'xx@yy.zz' 200 204 self.browser.getControl(name="form.school1").value = ['s0010'] 205 self.browser.getControl(name="form.subj_comb").value = ['CERT1'] 201 206 image = open(SAMPLE_IMAGE, 'rb') 202 207 ctrl = self.browser.getControl(name='form.passport') … … 226 231 in self.browser.contents) 227 232 self.assertEqual(self.tpuapplicant.state, 'paid') 233 # Create one applicant with same subject and same school 234 dummy = createObject(u'waeup.Applicant') 235 dummy.firstname = u'John' 236 dummy.lastname = u'Doe %s' %i 237 dummy.school1 = 's0012' 238 dummy.subj_comb = self.certificate 239 self.app['applicants'][ 240 self.tpucontainer.code].addApplicant(dummy) 241 IWorkflowState(dummy).setState('submitted') 242 self.browser.open(self.tpuapplicant_path + '/edit') 243 self.browser.getControl(name="form.school1").value = ['s0012'] 244 self.browser.getControl(name="form.subj_comb").value = ['CERT1'] 245 self.browser.getControl("Finally Submit").click() 246 self.assertTrue("Maximum number of applications per school exceeded." 247 in self.browser.contents) 248 self.assertEqual(self.tpuapplicant.state, 'paid') 249 self.browser.open(self.tpuapplicant_path + '/edit') 250 self.browser.getControl(name="form.school1").value = ['s0013'] 251 self.browser.getControl(name="form.subj_comb").value = ['CERT1'] 252 self.browser.getControl("Finally Submit").click() 253 self.assertTrue( 254 'Application submitted' in self.browser.contents) 255 self.assertEqual(self.tpuapplicant.state, 'submitted') 228 256 return 229 257
Note: See TracChangeset for help on using the changeset viewer.