Ignore:
Timestamp:
30 Apr 2012, 06:00:27 (13 years ago)
Author:
Henrik Bettermann
Message:

Add method and helpers to mass-create students from applicants.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/sample_container_data.csv

    r8033 r8314  
    1 code,title,prefix,entry_level,year,application_category,description,startdate,enddate,strict_deadline,mode
    2 app2012,General Studies 2012/2013,app,100,2012,basic,"This text can been seen by anonymous users.
     1code,title,prefix,year,application_category,description,startdate,enddate,strict_deadline,mode
     2app2012,General Studies 2012/2013,app,2012,basic,"This text can been seen by anonymous users.
    33>>de<<
    44Dieser Text kann von anonymen Benutzern gelesen werden.",2012-03-01,2012-04-25,1,create
    5 app2013,General Studies 2013/2014,app,100,2012,basic,"This text can been seen by anonymous users.
     5app2013,General Studies 2013/2014,app,2012,basic,"This text can been seen by anonymous users.
    66>>de<<
    77Dieser Text kann von anonymen Benutzern gelesen werden.",2013-03-01,2013-04-25,1,create
  • main/waeup.kofa/trunk/src/waeup/kofa/applicants/tests/test_applicantcopier.py

    r7811 r8314  
    2020"""
    2121import os
    22 from hurry.workflow.interfaces import IWorkflowInfo
     22from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState
    2323from zope.component import getUtility
    2424from waeup.kofa.testing import FunctionalLayer
     
    5454        (success, msg) = self.applicant.createStudent()
    5555        self.assertTrue(msg == 'Applicant has not yet been admitted.')
    56         IWorkflowInfo(self.applicant).fireTransition('start')
    57         IWorkflowInfo(self.applicant).fireTransition('pay')
    58         IWorkflowInfo(self.applicant).fireTransition('submit')
    59         IWorkflowInfo(self.applicant).fireTransition('admit')
     56        IWorkflowState(self.applicant).setState('admitted')
    6057        (success, msg) = self.applicant.createStudent()
    6158        self.assertTrue(msg == 'No course admitted provided.')
     
    9996        self.assertMatches('...John Tester...', self.browser.contents)
    10097
     98    def test_batch_copying(self):
     99        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     100        self.browser.open(self.manage_path)
     101        self.fill_correct_values()
     102        self.browser.getControl("Save").click()
     103        # Upload a passport picture
     104        ctrl = self.browser.getControl(name='form.passport')
     105        file_obj = open(
     106            os.path.join(os.path.dirname(__file__), 'test_image.jpg'),'rb')
     107        file_ctrl = ctrl.mech_control
     108        file_ctrl.add_file(file_obj, filename='my_photo.jpg')
     109        self.browser.getControl("Save").click() # submit form
     110        IWorkflowState(self.applicant).setState('admitted')
     111        self.browser.getControl(name="form.course_admitted").value = ['CERT1']
     112        self.browser.getControl("Save").click()
     113        self.browser.open(self.manage_container_path)
     114        self.browser.getControl("Create students from selected", index=0).click()
     115        self.assertTrue('No applicant selected' in self.browser.contents)
     116        ctrl = self.browser.getControl(name='val_id')
     117        ctrl.getControl(value=self.applicant.application_number).selected = True
     118        self.browser.getControl("Create students from selected", index=0).click()
     119        self.assertTrue('1 students successfully created' in self.browser.contents)
     120
    101121    def test_copier_wo_passport(self):
    102122        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     
    104124        self.fill_correct_values()
    105125        # Let's try to create the student
    106         IWorkflowInfo(self.applicant).fireTransition('start')
    107         IWorkflowInfo(self.applicant).fireTransition('pay')
    108         IWorkflowInfo(self.applicant).fireTransition('submit')
    109         IWorkflowInfo(self.applicant).fireTransition('admit')
     126        IWorkflowState(self.applicant).setState('admitted')
    110127        self.browser.getControl(name="form.course_admitted").value = ['CERT1']
    111128        self.browser.getControl("Save").click()
Note: See TracChangeset for help on using the changeset viewer.