Changeset 9209 for main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/browser/tests/test_browser.py
- Timestamp:
- 20 Sep 2012, 08:49:37 (12 years ago)
- Location:
- main/waeup.kofa/branches/uli-zc-async
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/waeup.kofa/branches/uli-zc-async
- Property svn:mergeinfo changed
-
main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/browser/tests/test_browser.py
r9166 r9209 21 21 import shutil 22 22 import tempfile 23 import pytz24 from datetime import datetime, timedelta25 from StringIO import StringIO26 23 import os 27 import grok28 24 from zc.async.testing import wait_for_result 29 from zope.event import notify 30 from zope.component import createObject, queryUtility, getUtility 25 from zope.component import createObject, getUtility 31 26 from zope.component.hooks import setSite, clearSite 32 from zope.catalog.interfaces import ICatalog33 27 from zope.security.interfaces import Unauthorized 34 from zope.securitypolicy.interfaces import IPrincipalRoleManager35 28 from zope.testbrowser.testing import Browser 36 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState37 29 from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase 38 30 from waeup.kofa.app import University … … 41 33 from waeup.kofa.university.faculty import Faculty 42 34 from waeup.kofa.university.department import Department 43 44 45 46 35 47 36 SAMPLE_FILE = os.path.join(os.path.dirname(__file__), 'test_file.csv') … … 90 79 self.app['faculties']['fac1']['dep1'].courses.addCourse( 91 80 self.course) 92 self.app['faculties']['fac1']['dep1'].certificates['CERT1'].addC ourseRef(81 self.app['faculties']['fac1']['dep1'].certificates['CERT1'].addCertCourse( 93 82 self.course, level=100) 94 83 … … 127 116 self.assertEqual(self.browser.headers['Status'], '200 Ok') 128 117 self.assertEqual(self.browser.url, self.datacenter_path) 129 self.browser.getLink("Upload CSV file").click()118 self.browser.getLink("Upload data").click() 130 119 file = open(SAMPLE_FILE) 131 120 ctrl = self.browser.getControl(name='uploadfile:file') … … 181 170 self.assertEqual(self.browser.headers['Status'], '200 Ok') 182 171 self.assertEqual(self.browser.url, self.datacenter_path) 183 self.browser.getLink("Export CSV file").click()172 self.browser.getLink("Export data").click() 184 173 self.browser.getControl(name="exporter").value = ['faculties'] 185 174 self.browser.getControl("Create CSV file").click() … … 204 193 # ...we can download the result 205 194 self.browser.getControl("Download").click() 206 self.assertEqual(self.browser.headers[' Content-Type'],195 self.assertEqual(self.browser.headers['content-type'], 207 196 'text/csv; charset=UTF-8') 197 self.assertEqual(self.browser.headers['content-disposition'], 198 'attachment; filename="WAeUP.Kofa_faculties.csv') 208 199 self.assertEqual(self.browser.contents, 209 'code,title,title_prefix\r\nfac1,Unnamed Faculty,faculty\r\n') 200 'code,title,title_prefix,users_with_local_roles\r\n' 201 'fac1,Unnamed Faculty,faculty,[]\r\n') 210 202 211 203 # after download, the job and the result file are removed … … 229 221 self.assertTrue('Discarded export result' in self.browser.contents) 230 222 return 223 224 def test_skeleton_download(self): 225 self.browser.addHeader('Authorization', 'Basic mgr:mgrpw') 226 self.browser.open(self.datacenter_path) 227 self.browser.getLink("Upload data").click() 228 self.assertTrue( 229 '<a href="skeleton?name=facultyprocessor">Download</a>' 230 in self.browser.contents) 231 self.browser.getLink(url='skeleton?name=facultyprocessor').click() 232 self.assertEqual(self.browser.headers['Status'], '200 Ok') 233 self.assertEqual(self.browser.headers['Content-Type'], 234 'text/csv; charset=UTF-8') 235 self.assertEqual(self.browser.contents, 236 'code,local_roles,title,title_prefix\r\n') 237 return
Note: See TracChangeset for help on using the changeset viewer.