Ignore:
Timestamp:
12 Oct 2018, 15:51:59 (6 years ago)
Author:
Henrik Bettermann
Message:

Add MedicalLaboratoryRequestForm?.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/kofacustom.edopoly/trunk/src/kofacustom/edopoly/students/tests/test_browser.py

    r15000 r15185  
    2121from StringIO import StringIO
    2222from hurry.workflow.interfaces import IWorkflowState, IWorkflowInfo
     23from mechanize import LinkNotFoundError
    2324from zope.securitypolicy.interfaces import IPrincipalRoleManager
    2425from zope.component.hooks import setSite, clearSite
     
    3435    IExtFileStore, IFileStoreNameChooser)
    3536from waeup.kofa.students.interfaces import IStudentsUtils
     37from waeup.kofa.browser.tests.test_pdf import samples_dir
    3638from kofacustom.edopoly.testing import FunctionalLayer
    3739
     
    4446    def test_dummytest(self):
    4547        return
     48
     49class StudentUITests(StudentsFullSetup):
     50    """Tests for customized student class views and pages
     51    """
     52
     53    layer = FunctionalLayer
     54
     55    def setUp(self):
     56        super(StudentUITests, self).setUp()
     57
     58
     59    def test_medical_laboratory_form(self):
     60        self.browser.open(self.login_path)
     61        self.browser.getControl(name="form.login").value = self.student_id
     62        self.browser.getControl(name="form.password").value = 'spwd'
     63        self.browser.getControl("Login").click()
     64        self.assertRaises(
     65            LinkNotFoundError,
     66            self.browser.getLink, 'Download medical laboratory request form')
     67        # Add medical fee payment ticket
     68        self.app['configuration']['2004'].medical = 180.0
     69        payment = createObject('waeup.StudentOnlinePayment')
     70        payment.p_category = u'medical'
     71        payment.p_session = self.student.current_session
     72        payment.p_id = u'anyid'
     73        payment.p_state = u'paid'
     74        self.student['payments']['anykey'] = payment
     75        self.browser.open(self.student_path)
     76        self.browser.getLink("Download medical laboratory request form").click()
     77        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     78        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
     79        path = os.path.join(samples_dir(), 'medical_laboratory_form.pdf')
     80        open(path, 'wb').write(self.browser.contents)
     81        print "Sample PDF medical_laboratory_form.pdf written to %s" % path
Note: See TracChangeset for help on using the changeset viewer.