Ignore:
Timestamp:
20 Sep 2012, 08:49:37 (12 years ago)
Author:
uli
Message:

Merge changes from update branch (includes trunk changes until r9107).

Location:
main/waeup.kofa/branches/uli-zc-async
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/branches/uli-zc-async

  • main/waeup.kofa/branches/uli-zc-async/src/waeup/kofa/browser/tests/test_browser.py

    r9166 r9209  
    2121import shutil
    2222import tempfile
    23 import pytz
    24 from datetime import datetime, timedelta
    25 from StringIO import StringIO
    2623import os
    27 import grok
    2824from zc.async.testing import wait_for_result
    29 from zope.event import notify
    30 from zope.component import createObject, queryUtility, getUtility
     25from zope.component import createObject, getUtility
    3126from zope.component.hooks import setSite, clearSite
    32 from zope.catalog.interfaces import ICatalog
    3327from zope.security.interfaces import Unauthorized
    34 from zope.securitypolicy.interfaces import IPrincipalRoleManager
    3528from zope.testbrowser.testing import Browser
    36 from hurry.workflow.interfaces import IWorkflowInfo, IWorkflowState
    3729from waeup.kofa.testing import FunctionalLayer, FunctionalTestCase
    3830from waeup.kofa.app import University
     
    4133from waeup.kofa.university.faculty import Faculty
    4234from waeup.kofa.university.department import Department
    43 
    44 
    45 
    4635
    4736SAMPLE_FILE = os.path.join(os.path.dirname(__file__), 'test_file.csv')
     
    9079        self.app['faculties']['fac1']['dep1'].courses.addCourse(
    9180            self.course)
    92         self.app['faculties']['fac1']['dep1'].certificates['CERT1'].addCourseRef(
     81        self.app['faculties']['fac1']['dep1'].certificates['CERT1'].addCertCourse(
    9382            self.course, level=100)
    9483
     
    127116        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    128117        self.assertEqual(self.browser.url, self.datacenter_path)
    129         self.browser.getLink("Upload CSV file").click()
     118        self.browser.getLink("Upload data").click()
    130119        file = open(SAMPLE_FILE)
    131120        ctrl = self.browser.getControl(name='uploadfile:file')
     
    181170        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    182171        self.assertEqual(self.browser.url, self.datacenter_path)
    183         self.browser.getLink("Export CSV file").click()
     172        self.browser.getLink("Export data").click()
    184173        self.browser.getControl(name="exporter").value = ['faculties']
    185174        self.browser.getControl("Create CSV file").click()
     
    204193        # ...we can download the result
    205194        self.browser.getControl("Download").click()
    206         self.assertEqual(self.browser.headers['Content-Type'],
     195        self.assertEqual(self.browser.headers['content-type'],
    207196                         'text/csv; charset=UTF-8')
     197        self.assertEqual(self.browser.headers['content-disposition'],
     198                         'attachment; filename="WAeUP.Kofa_faculties.csv')
    208199        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')
    210202
    211203        # after download, the job and the result file are removed
     
    229221        self.assertTrue('Discarded export result' in self.browser.contents)
    230222        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.