- Timestamp:
- 4 Jul 2014, 07:46:16 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r11676 r11730 3233 3233 return job_id 3234 3234 3235 def test_datacenter_export(self): 3236 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 3237 self.browser.open('http://localhost/app/datacenter/@@exportconfig') 3238 self.browser.getControl(name="exporter").value = ['bursary'] 3239 self.browser.getControl(name="session").value = ['2004'] 3240 self.browser.getControl(name="level").value = ['100'] 3241 self.browser.getControl(name="mode").value = ['ug_ft'] 3242 self.browser.getControl(name="payments_start").value = '13/12/2012' 3243 self.browser.getControl(name="payments_end").value = '14/12/2012' 3244 self.browser.getControl("Create CSV file").click() 3245 3246 # When the job is finished and we reload the page... 3247 job_id = self.wait_for_export_job_completed() 3248 # ... the csv file can be downloaded ... 3249 self.browser.open('http://localhost/app/datacenter/@@export') 3250 self.browser.getLink("Download").click() 3251 self.assertEqual(self.browser.headers['content-type'], 3252 'text/csv; charset=UTF-8') 3253 self.assertTrue( 3254 'filename="WAeUP.Kofa_bursary_%s.csv' % job_id in 3255 self.browser.headers['content-disposition']) 3256 self.assertEqual(len(self.app['datacenter'].running_exports), 1) 3257 job_id = self.app['datacenter'].running_exports[0][0] 3258 # ... and discarded 3259 self.browser.open('http://localhost/app/datacenter/@@export') 3260 self.browser.getControl("Discard").click() 3261 self.assertEqual(len(self.app['datacenter'].running_exports), 0) 3262 # Creation, downloading and discarding is logged 3263 logfile = os.path.join( 3264 self.app['datacenter'].storage, 'logs', 'datacenter.log') 3265 logcontent = open(logfile).read() 3266 self.assertTrue( 3267 'zope.mgr - students.browser.DatacenterExportJobContainerJobConfig ' 3268 '- exported: bursary (2004, 100, ug_ft, None, None, ' 3269 '13/12/2012, 14/12/2012), job_id=%s' 3270 % job_id in logcontent 3271 ) 3272 self.assertTrue( 3273 'zope.mgr - browser.pages.ExportCSVView ' 3274 '- downloaded: WAeUP.Kofa_bursary_%s.csv, job_id=%s' 3275 % (job_id, job_id) in logcontent 3276 ) 3277 self.assertTrue( 3278 'zope.mgr - browser.pages.ExportCSVPage ' 3279 '- discarded: job_id=%s' % job_id in logcontent 3280 ) 3281 3282 def test_payment_dates(self): 3283 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 3284 self.browser.open('http://localhost/app/datacenter/@@exportconfig') 3285 self.browser.getControl(name="exporter").value = ['bursary'] 3286 self.browser.getControl(name="session").value = ['2004'] 3287 self.browser.getControl(name="level").value = ['100'] 3288 self.browser.getControl(name="mode").value = ['ug_ft'] 3289 self.browser.getControl(name="payments_start").value = '13/12/2012' 3290 # If one payment date is missing, an error message appears 3291 self.browser.getControl(name="payments_end").value = '' 3292 self.browser.getControl("Create CSV file").click() 3293 self.assertTrue('Payment dates do not match format d/m/Y' 3294 in self.browser.contents) 3295 3235 3296 def test_faculties_export(self): 3236 3297 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') … … 3243 3304 self.browser.getControl(name="level").value = ['100'] 3244 3305 self.browser.getControl(name="mode").value = ['ug_ft'] 3306 self.browser.getControl(name="payments_start").value = '13/12/2012' 3307 self.browser.getControl(name="payments_end").value = '14/12/2012' 3245 3308 self.browser.getControl("Create CSV file").click() 3246 3309 … … 3267 3330 self.assertTrue( 3268 3331 'zope.mgr - students.browser.FacultiesExportJobContainerJobConfig ' 3269 '- exported: bursary (2004, 100, ug_ft, None, None), job_id=%s' 3332 '- exported: bursary (2004, 100, ug_ft, None, None, ' 3333 '13/12/2012, 14/12/2012), job_id=%s' 3270 3334 % job_id in logcontent 3271 3335 ) … … 3290 3354 self.browser.getControl(name="level").value = ['100'] 3291 3355 self.browser.getControl(name="mode").value = ['ug_ft'] 3356 # The testbrowser does not hide the payment period fields, but 3357 # values are ignored when using the students exporter. 3358 self.browser.getControl(name="payments_start").value = '13/12/2012' 3359 self.browser.getControl(name="payments_end").value = '14/12/2012' 3292 3360 self.browser.getControl("Create CSV file").click() 3293 3361 … … 3314 3382 self.assertTrue( 3315 3383 'zope.mgr - students.browser.DepartmentExportJobContainerJobConfig ' 3316 '- exported: students (2004, 100, ug_ft, dep1, None), job_id=%s' 3384 '- exported: students (2004, 100, ug_ft, dep1, None, ' 3385 '13/12/2012, 14/12/2012), job_id=%s' 3317 3386 % job_id in logcontent 3318 3387 ) … … 3360 3429 self.assertTrue( 3361 3430 'zope.mgr - students.browser.CertificateExportJobContainerJobConfig ' 3362 '- exported: students (2004, 100, None, None, CERT1), job_id=%s' 3431 '- exported: students (2004, 100, None, None, CERT1, None, None), ' 3432 'job_id=%s' 3363 3433 % job_id in logcontent 3364 3434 )
Note: See TracChangeset for help on using the changeset viewer.