- Timestamp:
- 23 Sep 2018, 05:05:04 (6 years ago)
- Location:
- main/waeup.kofa/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/trunk
- Property svn:mergeinfo changed
/main/waeup.kofa/branches/henrik-transcript-workflow (added) merged: 15127-15128,15133-15134,15140-15143,15145-15150,15152-15155,15157-15160,15162
- Property svn:mergeinfo changed
-
main/waeup.kofa/trunk/src/waeup/kofa
- Property svn:mergeinfo changed
/main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa (added) merged: 15128,15134,15140-15143,15145-15150,15152-15155,15157-15160,15162
- Property svn:mergeinfo changed
-
main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py
r15055 r15163 41 41 from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase 42 42 from waeup.kofa.app import University 43 from waeup.kofa.interfaces import IFileStoreNameChooser, IExtFileStore 43 44 from waeup.kofa.payments.interfaces import IPayer 44 45 from waeup.kofa.students.payments import StudentOnlinePayment … … 2119 2120 print "Sample PDF transcript.pdf written to %s" % path 2120 2121 2121 def test_process_transcript _request(self):2122 def test_process_transcript(self): 2122 2123 IWorkflowState(self.student).setState('transcript requested') 2123 2124 notify(grok.ObjectModifiedEvent(self.student)) 2124 self.student .transcript_comment = (2125 self.student['studycourse'].transcript_comment = ( 2125 2126 u'On 07/08/2013 08:59:54 UTC K1000000 wrote:\n\nComment line 1 \n' 2126 2127 'Comment line2\n\nDispatch Address:\nAddress line 1 \n' 2127 2128 'Address line2\n\n') 2128 # Create transcript officer2129 # Create officer with both roles 2129 2130 self.app['users'].addUser('mrtranscript', 'mrtranscriptsecret') 2130 2131 self.app['users']['mrtranscript'].email = 'mrtranscript@foo.ng' … … 2132 2133 prmglobal = IPrincipalRoleManager(self.app) 2133 2134 prmglobal.assignRoleToPrincipal('waeup.TranscriptOfficer', 'mrtranscript') 2134 # Login as transcript officer 2135 prmglobal.assignRoleToPrincipal('waeup.StudentsManager', 'mrtranscript') 2136 prmglobal.assignRoleToPrincipal('waeup.TranscriptSignee', 'mrtranscript') 2137 # Login 2135 2138 self.browser.open(self.login_path) 2136 2139 self.browser.getControl(name="form.login").value = 'mrtranscript' … … 2143 2146 '...<div>Transcript Officer</div>...', 2144 2147 self.browser.contents) 2145 # Officer can search for students in state 'transcrip rrequested'2148 # Officer can search for students in state 'transcript requested' 2146 2149 self.browser.open(self.container_path) 2147 self.browser.getControl(name="searchtype").value = ['transcript'] 2150 self.browser.getControl(name="searchtype").value = [ 2151 'transcript requested'] 2148 2152 self.browser.getControl("Find student(s)").click() 2149 2153 self.assertTrue('Anna Tester' in self.browser.contents) 2150 2154 self.browser.getLink("K1000000").click() 2151 self.browser.getLink("Manage transcript request").click() 2155 self.assertFalse('Release transcript request' in self.browser.contents) 2156 # Officers can still edit studycourse, studylevel and course tickets. 2157 self.browser.open(self.studycourse_path + '/manage') 2158 self.assertTrue('Undergraduate Full-Time</option>' 2159 in self.browser.contents) 2160 self.browser.getControl(name="form.certificate").value = ['CERT1'] 2161 self.browser.getControl(name="form.current_session").value = ['2004'] 2162 self.browser.getControl(name="form.current_verdict").value = ['A'] 2163 self.browser.getControl(name="form.entry_mode").value = ['ug_ft'] 2164 self.browser.getControl("Save").click() 2165 self.browser.getControl(name="form.current_level").value = ['100'] 2166 self.browser.getControl("Save").click() 2167 self.browser.getControl(name="addlevel").value = ['100'] 2168 self.browser.getControl(name="level_session").value = ['2004'] 2169 self.browser.getControl("Add study level").click() 2170 self.browser.getLink("100").click() 2171 self.browser.getLink("Manage").click() 2172 self.browser.getControl(name="form.level_session").value = ['2002'] 2173 self.browser.getControl("Save").click() 2174 self.browser.getLink("COURSE1").click() 2175 self.browser.getLink("Manage").click() 2176 self.browser.getControl("Save").click() 2177 self.assertTrue('Form has been saved' in self.browser.contents) 2178 # Officer can validate the transcript 2179 self.browser.open(self.studycourse_path + '/transcript') 2180 self.browser.getLink("Validate transcript").click() 2181 # After validation all manage forms are locked. 2182 self.browser.open(self.studycourse_path + '/manage') 2183 self.assertTrue('The requested form is locked' in self.browser.contents) 2184 self.assertFalse('Undergraduate Full-Time</option>' 2185 in self.browser.contents) 2186 self.browser.open(self.studycourse_path + '/100/manage') 2187 self.assertTrue('The requested form is locked' in self.browser.contents) 2188 self.browser.open(self.studycourse_path + '/100/COURSE1/manage') 2189 self.assertTrue('The requested form is locked' in self.browser.contents) 2190 2191 # Transcript can be signed if officer has the permission to sign 2192 #self.browser.open(self.studycourse_path + '/transcript') 2193 #self.assertFalse('Sign transcript' in self.browser.contents) 2194 #prmglobal = IPrincipalRoleManager(self.app) 2195 #prmglobal.assignRoleToPrincipal('waeup.TranscriptSignee', 'mrtranscript') 2196 2197 self.browser.open(self.studycourse_path + '/transcript') 2198 self.browser.getLink("Sign transcript electronically").click() 2199 # Transcript signing has been logged ... 2200 logfile = os.path.join( 2201 self.app['datacenter'].storage, 'logs', 'students.log') 2202 logcontent = open(logfile).read() 2203 self.assertTrue( 2204 'mrtranscript - students.browser.StudentTranscriptSignView - ' 2205 'K1000000 - Transcript signed' in logcontent) 2206 # ... appears in the student's history ... 2207 self.browser.open(self.history_path) 2208 self.assertTrue('Transcript signed by Ruth Gordon' 2209 in self.browser.contents) 2210 # ... and is also stored in the transcript_signee attribute. 2211 self.assertTrue( 2212 u'Electronically signed by Ruth Gordon (mrtranscript) on ' 2213 in self.student['studycourse'].transcript_signees) 2214 # Officer can release the transcript 2215 self.browser.open(self.studycourse_path + '/transcript') 2216 self.browser.getLink("Release transcript").click() 2152 2217 self.assertTrue(' UTC K1000000 wrote:<br><br>Comment line 1 <br>' 2153 2218 'Comment line2<br><br>Dispatch Address:<br>Address line 1 <br>' … … 2155 2220 self.browser.getControl(name="comment").value = ( 2156 2221 'Hello,\nYour transcript has been sent to the address provided.') 2157 self.browser.getControl("Save comment and mark as processed").click()2222 self.browser.getControl("Save comment and release transcript").click() 2158 2223 self.assertTrue( 2159 2224 'UTC mrtranscript wrote:\n\nHello,\nYour transcript has ' 2160 2225 'been sent to the address provided.\n\n' 2161 in self.student .transcript_comment)2226 in self.student['studycourse'].transcript_comment) 2162 2227 # The comment has been logged 2163 2228 logfile = os.path.join( … … 2165 2230 logcontent = open(logfile).read() 2166 2231 self.assertTrue( 2167 'mrtranscript - students.browser.StudentTranscriptRe questProcessFormPage - '2232 'mrtranscript - students.browser.StudentTranscriptReleaseFormPage - ' 2168 2233 'K1000000 - comment: Hello,<br>' 2169 2234 'Your transcript has been sent to the address provided' 2170 2235 in logcontent) 2236 # File has been stored in the file system 2237 # Check if transcript exists in the file system and is a PDF file 2238 storage = getUtility(IExtFileStore) 2239 file_id = IFileStoreNameChooser( 2240 self.student).chooseName(attr='final_transcript.pdf') 2241 pdf = storage.getFile(file_id).read() 2242 self.assertTrue(len(pdf) > 0) 2243 self.assertEqual(pdf[:8], '%PDF-1.4') 2244 # Copy the file to samples_dir 2245 path = os.path.join(samples_dir(), 'final_transcript.pdf') 2246 open(path, 'wb').write(pdf) 2247 print "Sample PDF final_transcript.pdf written to %s" % path 2248 # Check if there is an transcript pdf link in UI 2249 self.browser.open(self.student_path) 2250 self.assertTrue('Final Transcript' in self.browser.contents) 2251 self.browser.getLink("Final Transcript").click() 2252 self.assertEqual(self.browser.headers['Status'], '200 Ok') 2253 self.assertEqual(self.browser.headers['Content-Type'], 2254 'application/pdf') 2255 # Transcript views are no longer accessible 2256 self.browser.open(self.studycourse_path) 2257 self.assertFalse('studycourse/transcript' in self.browser.contents) 2258 self.browser.open(self.studycourse_path + '/transcript') 2259 self.assertTrue('Forbidden!' in self.browser.contents) 2260 self.browser.open(self.studycourse_path + '/transcript.pdf') 2261 self.assertTrue('Forbidden!' in self.browser.contents) 2262 # If we reset the transcript process 2263 # (can't be done by transcript officer), the file will be deleted 2264 IWorkflowInfo(self.student).fireTransition('reset11') 2265 self.browser.open(self.student_path) 2266 self.assertFalse('Final Transcript' in self.browser.contents) 2267 # ... and transcript process information has been removed 2268 self.assertEqual(self.student['studycourse'].transcript_comment, None) 2269 self.assertEqual(self.student['studycourse'].transcript_signees, None) 2270 2271 def test_landingpage_transcript_officer(self): 2272 IWorkflowState(self.student).setState('transcript requested') 2273 notify(grok.ObjectModifiedEvent(self.student)) 2274 # Create transcript officer 2275 self.app['users'].addUser('mrtranscript', 'mrtranscriptsecret') 2276 self.app['users']['mrtranscript'].email = 'mrtranscript@foo.ng' 2277 self.app['users']['mrtranscript'].title = 'Ruth Gordon' 2278 # We assign transcript officer role at faculty level 2279 fac = self.app['faculties']['fac1'] 2280 prmlocal = IPrincipalRoleManager(fac) 2281 prmlocal.assignRoleToPrincipal( 2282 'waeup.local.TranscriptOfficer', 'mrtranscript') 2283 notify(LocalRoleSetEvent( 2284 fac, 'waeup.local.TranscriptOfficer', 'mrtranscript', granted=True)) 2285 # Login as transcript officer 2286 self.browser.open(self.login_path) 2287 self.browser.getControl(name="form.login").value = 'mrtranscript' 2288 self.browser.getControl(name="form.password").value = 'mrtranscriptsecret' 2289 self.browser.getControl("Login").click() 2290 self.assertMatches('...You logged in...', self.browser.contents) 2291 # Officer is on landing page and does see the transcript link 2292 self.assertTrue( 2293 'http://localhost/app/students/K1000000/studycourse/transcript' 2294 in self.browser.contents) 2295 self.browser.getLink("K1000000").click() 2296 self.assertTrue( 2297 'Anna Tester: Transcript Data' in self.browser.contents) 2298 # Officer is on transcript page and can validate the transcript 2299 self.browser.getLink("Validate transcript").click() 2300 self.assertTrue( 2301 '<div class="alert alert-success">Transcript validated.</div>' 2302 in self.browser.contents) 2303 # Officer is still on transcript page and can release the transcript 2304 self.browser.getLink("Release transcript").click() 2305 self.browser.getControl("Save comment and release transcript").click() 2306 self.assertTrue( 2307 '<div class="alert alert-success">' 2308 'Transcript released and final transcript file saved.</div>' 2309 in self.browser.contents) 2310 2311 def test_landingpage_transcript_signee(self): 2312 IWorkflowState(self.student).setState('transcript validated') 2313 notify(grok.ObjectModifiedEvent(self.student)) 2314 # Create transcript signee 2315 self.app['users'].addUser('mrtranscript', 'mrtranscriptsecret') 2316 self.app['users']['mrtranscript'].email = 'mrtranscript@foo.ng' 2317 self.app['users']['mrtranscript'].title = 'Ruth Gordon' 2318 # We assign transcript officer role at faculty level 2319 fac = self.app['faculties']['fac1'] 2320 prmlocal = IPrincipalRoleManager(fac) 2321 prmlocal.assignRoleToPrincipal( 2322 'waeup.local.TranscriptSignee', 'mrtranscript') 2323 notify(LocalRoleSetEvent( 2324 fac, 'waeup.local.TranscriptSignee', 'mrtranscript', granted=True)) 2325 # Login as transcript officer 2326 self.browser.open(self.login_path) 2327 self.browser.getControl(name="form.login").value = 'mrtranscript' 2328 self.browser.getControl(name="form.password").value = 'mrtranscriptsecret' 2329 self.browser.getControl("Login").click() 2330 self.assertMatches('...You logged in...', self.browser.contents) 2331 # Officer is on landing page and does see the transcript link 2332 self.assertTrue( 2333 'http://localhost/app/students/K1000000/studycourse/transcript' 2334 in self.browser.contents) 2335 self.browser.getLink("K1000000").click() 2336 self.assertTrue( 2337 'Anna Tester: Transcript Data' in self.browser.contents) 2338 # Officer is on transcript page and can sign the transcript 2339 self.browser.getLink("Sign transcript").click() 2340 self.assertTrue( 2341 '<div class="alert alert-success">Transcript signed.</div>' 2342 in self.browser.contents) 2343 # Officer is still on transcript page 2344 self.assertTrue( 2345 'Anna Tester: Transcript Data' in self.browser.contents) 2346 # Officer can sign the transcript only once 2347 self.browser.getLink("Sign transcript").click() 2348 self.assertTrue( 2349 '<div class="alert alert-warning">' 2350 'You have already signed this transcript.</div>' 2351 in self.browser.contents) 2352 # Signature can be seen on transcript page 2353 self.assertTrue( 2354 'Electronically signed by Ruth Gordon (mrtranscript) on' 2355 in self.browser.contents) 2356 2171 2357 2172 2358 class StudentUITests(StudentsFullSetup): … … 3303 3489 '... UTC K1000000 wrote:\n\nComment line 1 \n' 3304 3490 'Comment line2\n\nDispatch Address:\nAddress line 1 \n' 3305 'Address line2\n\n', self.student .transcript_comment)3491 'Address line2\n\n', self.student['studycourse'].transcript_comment) 3306 3492 # The comment has been logged 3307 3493 logfile = os.path.join( … … 3572 3758 'firstname,flash_notice,lastname,matric_number,middlename,nationality,' 3573 3759 'officer_comment,perm_address,personal_updated,phone,reg_number,' 3574 'sex,student_id,suspended,suspended_comment, transcript_comment,'3575 'password,state,history,certcode,is_postgrad, current_level,'3576 'current_ session\r\n'3760 'sex,student_id,suspended,suspended_comment,' 3761 'password,state,history,certcode,is_postgrad,' 3762 'current_level,current_session\r\n' 3577 3763 ',,1981-02-04#,aa@aa.ng,,Anna,,Tester,234,,,,,,' 3578 '1234#,123,m,K1000000,0,, ,{SSHA}' in self.browser.contents)3764 '1234#,123,m,K1000000,0,,{SSHA}' in self.browser.contents) 3579 3765 3580 3766 def test_payment_dates(self): … … 3678 3864 'firstname,flash_notice,lastname,matric_number,middlename,nationality,' 3679 3865 'officer_comment,perm_address,personal_updated,phone,reg_number,' 3680 'sex,student_id,suspended,suspended_comment, transcript_comment,'3681 'password,state,history,certcode,is_postgrad, current_level,'3682 'current_ session\r\n'3866 'sex,student_id,suspended,suspended_comment,' 3867 'password,state,history,certcode,is_postgrad,' 3868 'current_level,current_session\r\n' 3683 3869 ',,1981-02-04#,aa@aa.ng,,Anna,,Tester,234,,,,,,' 3684 '1234#,123,m,K1000000,0,, ,{SSHA}' in self.browser.contents)3870 '1234#,123,m,K1000000,0,,{SSHA}' in self.browser.contents) 3685 3871 self.assertEqual(len(self.app['datacenter'].running_exports), 1) 3686 3872 job_id = self.app['datacenter'].running_exports[0][0]
Note: See TracChangeset for help on using the changeset viewer.