- Timestamp:
- 21 Sep 2012, 08:19:35 (13 years ago)
- Location:
- main/waeup.kofa/branches/uli-zc-async
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/uli-zc-async
- Property svn:mergeinfo changed
/main/waeup.kofa/branches/uli-async-update removed /main/waeup.kofa/branches/uli-autoinclude-less removed /main/waeup.kofa/trunk removed
- Property svn:mergeinfo changed
-
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/tests/test_applicantcopier.py
r9209 r9211 21 21 import os 22 22 import grok 23 from datetime import datetime24 23 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState 25 24 from zope.event import notify … … 29 28 from waeup.kofa.interfaces import IExtFileStore, IFileStoreNameChooser 30 29 from waeup.kofa.applicants.tests.test_browser import ApplicantsFullSetup 31 32 session = datetime.now().year - 233 30 34 31 class ApplicantCopierFunctionalTests(ApplicantsFullSetup): … … 70 67 self.browser.getControl(name="form.course_admitted").value = ['CERT1'] 71 68 self.browser.getControl("Save").click() 72 # Maybe the certificate has meanwhile been removed73 del self.app['faculties']['fac1']['dep1'].certificates['CERT1']74 (success, msg) = self.applicant.createStudent()75 self.assertFalse(success)76 self.assertTrue('ConstraintNotSatisfied: CERT1' in msg)77 # Ok, lets add the certificate and try again78 self.app['faculties']['fac1']['dep1'].certificates.addCertificate(79 self.certificate)80 69 (success, msg) = self.applicant.createStudent() 81 70 self.assertTrue('created' in msg) … … 93 82 self.assertEqual(student.firstname, 'John') 94 83 self.assertEqual(student.lastname, 'Tester') 95 # student_id set in application record?96 self.assertEqual(self.applicant.student_id, student.student_id)97 84 # Check if passport image has been copied 98 85 storage = getUtility(IExtFileStore) … … 123 110 # Has the student studycourse the correct attributes? 124 111 self.assertEqual(student['studycourse'].certificate.code, 'CERT1') 125 self.assertEqual(student['studycourse'].entry_session, session)112 self.assertEqual(student['studycourse'].entry_session, 2009) 126 113 self.assertEqual(student['studycourse'].entry_mode, 'ug_ft') 127 self.assertEqual(student['studycourse'].current_session, session)114 self.assertEqual(student['studycourse'].current_session, 2009) 128 115 self.assertEqual(student['studycourse'].current_level, 100) 129 116 -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/tests/test_authentication.py
r9209 r9211 64 64 email = None 65 65 phone = None 66 suspended = False67 66 68 67 -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/tests/test_browser.py
r9209 r9211 23 23 import tempfile 24 24 import grok 25 from datetime import datetime26 25 from StringIO import StringIO 27 26 from datetime import datetime, date, timedelta … … 47 46 PH_LEN = 2059 # Length of placeholder file 48 47 49 session_1 = datetime.now().year - 250 container_name_1 = u'app%s' % session_151 session_2 = datetime.now().year - 152 container_name_2 = u'app%s' % session_253 54 48 class ApplicantsFullSetup(FunctionalTestCase): 55 49 # A test case that only contains a setup and teardown … … 86 80 self.manage_root_path = self.root_path + '/@@manage' 87 81 self.add_container_path = self.root_path + '/@@add' 88 self.container_path = 'http://localhost/app/applicants/ %s' % container_name_182 self.container_path = 'http://localhost/app/applicants/app2009' 89 83 self.manage_container_path = self.container_path + '/@@manage' 90 84 91 85 # Add an applicants container 92 86 applicantscontainer = ApplicantsContainer() 93 applicantscontainer.code = container_name_187 applicantscontainer.code = u'app2009' 94 88 applicantscontainer.prefix = 'app' 95 applicantscontainer.year = session_196 applicantscontainer.title = u'This is the %s container' % container_name_189 applicantscontainer.year = 2009 90 applicantscontainer.title = u'This is the app2009 container' 97 91 applicantscontainer.application_category = 'basic' 98 92 applicantscontainer.mode = 'create' … … 101 95 applicantscontainer.startdate = datetime.now(pytz.utc) - delta 102 96 applicantscontainer.enddate = datetime.now(pytz.utc) + delta 103 self.app['applicants'][ container_name_1] = applicantscontainer104 self.applicantscontainer = self.app['applicants'][ container_name_1]97 self.app['applicants']['app2009'] = applicantscontainer 98 self.applicantscontainer = self.app['applicants']['app2009'] 105 99 106 100 # Populate university … … 141 135 self.applicant.reg_number = u'1234' 142 136 self.applicant.course1 = certificate 143 app['applicants'][ container_name_1].addApplicant(self.applicant)137 app['applicants']['app2009'].addApplicant(self.applicant) 144 138 IUserAccount( 145 self.app['applicants'][ container_name_1][139 self.app['applicants']['app2009'][ 146 140 self.applicant.application_number]).setPassword('apwd') 147 141 self.manage_path = 'http://localhost/app/applicants/%s/%s/%s' % ( 148 container_name_1, self.applicant.application_number, 'manage')142 'app2009', self.applicant.application_number, 'manage') 149 143 self.edit_path = 'http://localhost/app/applicants/%s/%s/%s' % ( 150 container_name_1, self.applicant.application_number, 'edit')144 'app2009', self.applicant.application_number, 'edit') 151 145 self.view_path = 'http://localhost/app/applicants/%s/%s' % ( 152 container_name_1, self.applicant.application_number)146 'app2009', self.applicant.application_number) 153 147 154 148 def login(self): … … 309 303 'There were errors' in self.browser.contents) 310 304 self.browser.getControl(name="form.prefix").value = ['app'] 311 self.browser.getControl(name="form.year").value = [ str(session_2)]305 self.browser.getControl(name="form.year").value = ['2010'] 312 306 self.browser.getControl(name="form.mode").value = ['create'] 313 307 self.browser.getControl( … … 323 317 self.browser.open(self.add_container_path) 324 318 self.browser.getControl(name="form.prefix").value = ['app'] 325 self.browser.getControl(name="form.year").value = [ str(session_2)]319 self.browser.getControl(name="form.year").value = ['2010'] 326 320 self.browser.getControl(name="form.mode").value = ['create'] 327 321 self.browser.getControl( … … 332 326 self.browser.open(self.manage_root_path) 333 327 ctrl = self.browser.getControl(name='val_id') 334 ctrl.getControl(value= container_name_2).selected = True328 ctrl.getControl(value='app2010').selected = True 335 329 self.browser.getControl("Remove selected", index=0).click() 336 330 self.assertTrue('Successfully removed:' in self.browser.contents) 337 331 self.browser.open(self.add_container_path) 338 332 self.browser.getControl(name="form.prefix").value = ['app'] 339 self.browser.getControl(name="form.year").value = [ str(session_2)]333 self.browser.getControl(name="form.year").value = ['2010'] 340 334 self.browser.getControl(name="form.mode").value = ['create'] 341 335 #self.browser.getControl(name="form.ac_prefix").value = ['APP'] … … 343 337 name="form.application_category").value = ['basic'] 344 338 self.browser.getControl("Add applicants container").click() 345 del self.app['applicants'][ container_name_2]339 del self.app['applicants']['app2010'] 346 340 ctrl = self.browser.getControl(name='val_id') 347 ctrl.getControl(value= container_name_2).selected = True341 ctrl.getControl(value='app2010').selected = True 348 342 self.browser.getControl("Remove selected", index=0).click() 349 343 self.assertMatches('...Could not delete...', self.browser.contents) … … 471 465 self.browser.open(self.slip_path) 472 466 self.assertTrue( 473 'Please pay and submitbefore trying to download the application slip.'467 'Please pay before trying to download the application slip.' 474 468 in self.browser.contents) 475 469 # If applicant is in correct state the pdf slip can be opened. 476 IWorkflowState(self.applicant).setState(' submitted')470 IWorkflowState(self.applicant).setState('paid') 477 471 self.browser.open(self.manage_path) 478 472 self.browser.getLink("Download application slip").click() … … 499 493 self.browser.headers['content-length'], str(PH_LEN)) 500 494 501 def test_applicant_login(self):502 self.applicant.suspended = True503 self.login()504 self.assertTrue(505 'You entered invalid credentials.' in self.browser.contents)506 self.applicant.suspended = False507 self.browser.getControl("Login").click()508 self.assertTrue(509 'You logged in.' in self.browser.contents)510 511 495 def test_applicant_access(self): 512 496 # Applicants can edit their record 513 497 self.browser.open(self.login_path) 514 498 self.login() 515 self.assertTrue(516 'You logged in.' in self.browser.contents)517 499 self.browser.open(self.edit_path) 518 500 self.assertTrue(self.browser.url != self.login_path) … … 717 699 in self.browser.contents) 718 700 configuration = SessionConfiguration() 719 configuration.academic_session = session_1701 configuration.academic_session = 2009 720 702 configuration.application_fee = 200.0 721 703 self.app['configuration'].addSessionConfiguration(configuration) … … 745 727 payment_id = self.applicant.keys()[0] 746 728 payment = self.applicant[payment_id] 747 self.assertEqual(payment.p_item,'This is the %s container' % container_name_1)748 self.assertEqual(payment.p_session, session_1)729 self.assertEqual(payment.p_item,'This is the app2009 container') 730 self.assertEqual(payment.p_session,2009) 749 731 self.assertEqual(payment.p_category,'application') 750 732 self.assertEqual(payment.amount_auth,200.0) … … 839 821 self.browser.getControl("Final Submit").click() 840 822 self.assertTrue( 841 ' Application submitted' in self.browser.contents)823 '... submitted ...' in self.browser.contents) 842 824 # ... or allow submission after deadline. 843 825 IWorkflowState(self.applicant).setState('paid') … … 848 830 self.browser.getControl("Final Submit").click() 849 831 self.assertTrue( 850 ' Application submitted' in self.browser.contents)832 '... submitted ...' in self.browser.contents) 851 833 self.browser.goBack(count=1) 852 834 self.browser.getControl("Save").click() … … 935 917 self.browser.getControl(name="form.phone.area").value = '555' 936 918 self.browser.getControl(name="form.phone.ext").value = '6666666' 937 self.browser.getControl(" Sendlogin credentials").click()919 self.browser.getControl("Get login credentials").click() 938 920 self.assertEqual(self.browser.url, 939 921 self.container_path + '/registration_complete?email=xx%40yy.zz') … … 962 944 self.browser.getControl(name="form.reg_number").value = 'anynumber' 963 945 self.browser.getControl(name="form.email").value = 'xx@yy.zz' 964 self.browser.getControl(" Sendlogin credentials").click()946 self.browser.getControl("Get login credentials").click() 965 947 self.assertTrue('No application record found.' 966 948 in self.browser.contents) … … 972 954 self.browser.getControl(name="form.reg_number").value = '1234' 973 955 self.browser.getControl(name="form.email").value = 'xx@yy.zz' 974 self.browser.getControl(" Sendlogin credentials").click()956 self.browser.getControl("Get login credentials").click() 975 957 self.assertTrue('An error occurred.' in self.browser.contents) 976 958 # Let's set this attribute manually … … 981 963 self.browser.getControl(name="form.reg_number").value = '1234' 982 964 self.browser.getControl(name="form.email").value = 'xx@yy.zz' 983 self.browser.getControl(" Sendlogin credentials").click()965 self.browser.getControl("Get login credentials").click() 984 966 # Anonymous is not informed that firstname verification failed. 985 967 # It seems that the record doesn't exist. … … 991 973 self.browser.getControl(name="form.firstname").value = 'John' 992 974 self.browser.getControl(name="form.reg_number").value = '1234' 993 self.browser.getControl(" Sendlogin credentials").click()975 self.browser.getControl("Get login credentials").click() 994 976 self.assertTrue('Your password has already been set and used.' 995 977 in self.browser.contents) 996 978 #IUserAccount( 997 # self.app['applicants'][ container_name_1][979 # self.app['applicants']['app2009'][ 998 980 # self.applicant.application_number]).context.password = None 999 981 # Even without unsetting the password we can re-register if state … … 1005 987 self.browser.getControl(name="form.reg_number").value = '1234' 1006 988 self.browser.getControl(name="form.email").value = 'new@yy.zz' 1007 self.browser.getControl(" Sendlogin credentials").click()989 self.browser.getControl("Get login credentials").click() 1008 990 # Yeah, we succeded ... 1009 991 self.assertTrue('Your registration was successful.' … … 1021 1003 self.browser.getControl(name="form.identifier").value = '1234' 1022 1004 self.browser.getControl(name="form.email").value = 'aa@aa.ng' 1023 self.browser.getControl(" Sendlogin credentials").click()1005 self.browser.getControl("Get login credentials").click() 1024 1006 self.assertTrue('No record found' in self.browser.contents) 1025 1007 self.applicant.email = 'aa@aa.ng' … … 1029 1011 self.browser.getControl(name="form.identifier").value = '1234' 1030 1012 self.browser.getControl(name="form.email").value = 'aa@aa.ng' 1031 self.browser.getControl(" Sendlogin credentials").click()1013 self.browser.getControl("Get login credentials").click() 1032 1014 self.assertTrue( 1033 1015 'An email with your user name and password has been sent' -
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/applicants/tests/test_export.py
r9209 r9211 120 120 applicant.course_admitted = self.certificate 121 121 applicant.notice = u'Some notice\nin lines.' 122 applicant.screening_score = 98 123 applicant.screening_venue = u'Exam Room' 122 124 applicant.password = 'any password' 123 125 result_entry = ResultEntry( … … 142 144 'course_admitted,date_of_birth,display_fullname,email,firstname,' 143 145 'history,lastname,locked,middlename,notice,password,phone,' 144 'reg_number,s ex,state,'145 'student_id, suspended,container_code\r\n'146 'reg_number,screening_score,screening_venue,sex,state,' 147 'student_id,container_code\r\n' 146 148 'dp2011_654321,,654321,,,,,Anna Tester,,Anna,' 147 149 in result) 148 150 self.assertTrue( 149 151 'Application initialized by system\'],Tester,' 150 '0,,,,,,, initialized,,0,dp2011\r\n'152 '0,,,,,,,,,initialized,,dp2011\r\n' 151 153 in result) 152 154 return … … 166 168 'course_admitted,date_of_birth,display_fullname,email,firstname,' 167 169 'history,lastname,locked,middlename,notice,password,phone,' 168 'reg_number,s ex,state,'169 'student_id, suspended,container_code\r\n'170 'reg_number,screening_score,screening_venue,sex,state,' 171 'student_id,container_code\r\n' 170 172 'dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,' 171 173 'Anna M. Tester,anna@sample.com,Anna,' … … 174 176 'Application initialized by system\'],' 175 177 'Tester,0,M.,"Some notice\nin lines.",any password,' 176 '+234-123-12345 #,123456,f,initialized,,0,dp2011\r\n'178 '+234-123-12345,123456,98,Exam Room,f,initialized,,dp2011\r\n' 177 179 in result) 178 180 … … 190 192 'course_admitted,date_of_birth,display_fullname,email,firstname,' 191 193 'history,lastname,locked,middlename,notice,password,phone,' 192 'reg_number,s ex,state,'193 'student_id, suspended,container_code\r\n'194 'reg_number,screening_score,screening_venue,sex,state,' 195 'student_id,container_code\r\n' 194 196 'dp2011_654321,,654321,CERT1,CERT1,CERT1,1981-02-04#,' 195 197 'Anna M. Tester,anna@sample.com,Anna,' … … 198 200 'Application initialized by system\'],' 199 201 'Tester,0,M.,"Some notice\nin lines.",any password,' 200 '+234-123-12345 #,123456,f,initialized,,0,dp2011\r\n'201 in result) 202 return 202 '+234-123-12345,123456,98,Exam Room,f,initialized,,dp2011\r\n' 203 in result) 204 return
Note: See TracChangeset for help on using the changeset viewer.