Ignore:
Timestamp:
3 Dec 2016, 08:29:30 (8 years ago)
Author:
Henrik Bettermann
Message:

Add AlumniRequestPasswordPage?.

Location:
main/waeup.aaue/trunk/src/waeup/aaue
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.aaue/trunk/src/waeup/aaue/applicants/interfaces.py

    r14304 r14306  
    551551
    552552    dispatch_address = schema.Text(
    553         title = _(u'Dispatch Address'),
    554         description = u'Address to which transcript should be posted.',
     553        title = _(u'Dispatch Addresses'),
     554        description = u'Addresses to which transcript should be posted.',
    555555        required = False,
    556556        readonly = False,
     
    607607        )
    608608
     609    no_copies = schema.Choice(
     610        title = _(u'Number of Copies'),
     611        description = u'Must correspond with the number of dispatch addresses above.',
     612        values=[1, 2, 3, 4],
     613        required = False,
     614        readonly = False,
     615        default = 1,
     616        )
     617
    609618class ICertificateRequest(IKofaObject):
    610619    """A transcript applicant.
     
    688697
    689698    dispatch_address = schema.Text(
    690         title = _(u'Dispatch Address'),
    691         description = u'Address to which certificate should be posted.',
     699        title = _(u'Dispatch Addresses'),
     700        description = u'Addresses to which certificate should be posted.',
    692701        required = False,
    693702        readonly = False,
     
    713722        required = False,
    714723        readonly = False,
     724        )
     725
     726    no_copies = schema.Choice(
     727        title = _(u'Number of Copies'),
     728        description = u'Must correspond with the number of dispatch addresses above.',
     729        values=[1, 2, 3, 4],
     730        required = False,
     731        readonly = False,
     732        default = 1,
    715733        )
    716734
  • main/waeup.aaue/trunk/src/waeup/aaue/students/browser.py

    r14302 r14306  
    2929from waeup.kofa.widgets.datewidget import FriendlyDatetimeDisplayWidget
    3030from waeup.kofa.interfaces import (
    31     IKofaUtils, academic_sessions_vocab, ICSVExporter)
    32 from waeup.kofa.students.interfaces import IStudentsUtils, IStudent
     31    IKofaUtils, academic_sessions_vocab, ICSVExporter, IKofaObject)
     32from waeup.kofa.students.interfaces import (
     33    IStudentsUtils, IStudent, IStudentRequestPW)
    3334from waeup.kofa.students.workflow import PAID, REGISTERED, RETURNING
    3435from waeup.kofa.students.studylevel import getGradeWeightFromScore
     
    5152    StudyCourseTranscriptPage,
    5253    DownloadScoresView,
     54    StudentRequestPasswordPage
    5355    )
    5456from kofacustom.nigeria.students.browser import (
     
    8183from waeup.aaue.interswitch.browser import gateway_net_amt
    8284from waeup.aaue.interfaces import MessageFactory as _
     85
     86grok.context(IKofaObject)  # Make IKofaObject the default context
    8387
    8488class CustomStudentBaseDisplayFormPage(NigeriaStudentBaseDisplayFormPage):
     
    866870                                 code=self.context.code)
    867871        return
     872
     873class AlumniRequestPasswordPage(StudentRequestPasswordPage):
     874    """Captcha'd request password page for students.
     875    """
     876    grok.name('alumni_requestpw')
     877    grok.require('waeup.Anonymous')
     878    grok.template('alumni_requestpw')
     879    form_fields = grok.AutoFields(IStudentRequestPW).select(
     880        'lastname','number','email')
     881    label = _('Search student record and send password for first-time login')
     882
     883    def _redirect_no_student(self):
     884        self.flash(_('No student record found.'), type="warning")
     885        self.redirect(self.application_url() + '/applicants/trans2017/register')
     886        return
  • main/waeup.aaue/trunk/src/waeup/aaue/students/tests/test_browser.py

    r14288 r14306  
    3838from waeup.kofa.authentication import LocalRoleSetEvent
    3939from waeup.kofa.browser.tests.test_pdf import samples_dir
     40from waeup.kofa.applicants.container import ApplicantsContainer
    4041from waeup.aaue.testing import FunctionalLayer
    4142
     
    11071108        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    11081109        self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
     1110
     1111    def test_alumni_request_pw(self):
     1112        # Add an applicants container
     1113        applicantscontainer = ApplicantsContainer()
     1114        applicantscontainer.code = u'trans2017'
     1115        applicantscontainer.prefix = 'trans'
     1116        applicantscontainer.year = 2017
     1117        applicantscontainer.title = u'This is the trans2017 container'
     1118        applicantscontainer.application_category = 'no'
     1119        applicantscontainer.mode = 'create'
     1120        applicantscontainer.strict_deadline = True
     1121        delta = timedelta(days=10)
     1122        applicantscontainer.startdate = datetime.now(pytz.utc) - delta
     1123        applicantscontainer.enddate = datetime.now(pytz.utc) + delta
     1124        self.app['applicants']['trans2017'] = applicantscontainer
     1125        self.applicantscontainer = self.app['applicants']['trans2017']
     1126        # Student with wrong number can't be found.
     1127        # Applicant is redirected to application section.
     1128        self.browser.open('http://localhost/app/alumni_requestpw')
     1129        self.browser.getControl(name="form.lastname").value = 'Tester'
     1130        self.browser.getControl(name="form.number").value = 'anynumber'
     1131        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
     1132        self.browser.getControl("Send login credentials").click()
     1133        self.assertTrue('No student record found.'
     1134            in self.browser.contents)
     1135        self.assertEqual(self.browser.url,
     1136            'http://localhost/app/applicants/trans2017/register')
Note: See TracChangeset for help on using the changeset viewer.