Ignore:
Timestamp:
25 Nov 2016, 10:06:54 (8 years ago)
Author:
Henrik Bettermann
Message:

Add control button to create graduated students.

Location:
main/waeup.kofa/trunk/src/waeup/kofa/students
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.kofa/trunk/src/waeup/kofa/students/browser.py

    r14286 r14293  
    370370        return
    371371
     372    @action(_('Create graduated student'), style='primary')
     373    def addGraduatedStudent(self, **data):
     374        student = createObject(u'waeup.Student')
     375        self.applyData(student, **data)
     376        self.context.addStudent(student)
     377        IWorkflowState(student).setState(GRADUATED)
     378        self.flash(_('Student record created.'))
     379        self.redirect(self.url(self.context[student.student_id], 'index'))
     380        return
     381
    372382class LoginAsStudentStep1(KofaEditFormPage):
    373383    """ View to temporarily set a student password.
  • main/waeup.kofa/trunk/src/waeup/kofa/students/tests/test_browser.py

    r14286 r14293  
    425425        self.browser.getControl("Find student(s)").click()
    426426        self.assertTrue('No student found' in self.browser.contents)
     427        return
     428
     429    def test_add_graduated_students(self):
     430        # Managers can add search and remove students
     431        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
     432        self.browser.open(self.manage_container_path)
     433        self.browser.getLink("Add student").click()
     434        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     435        self.assertEqual(self.browser.url, self.add_student_path)
     436        self.browser.getControl(name="form.firstname").value = 'Bob'
     437        self.browser.getControl(name="form.lastname").value = 'Tester'
     438        self.browser.getControl(name="form.reg_number").value = '1234'
     439        self.browser.getControl("Create graduated student").click()
     440        self.assertTrue('Student record created' in self.browser.contents)
     441        self.assertEqual(self.app['students']['K1000001'].state, 'graduated')
    427442        return
    428443
Note: See TracChangeset for help on using the changeset viewer.