Ignore:
Timestamp:
23 Jun 2012, 06:32:56 (13 years ago)
Author:
Henrik Bettermann
Message:

Add password request page for first-time login withot email address and pwd activation code.

To do: What happens if a wrong email address has been entered. Solution: We need to remember if a student has logged in.

File:
1 edited

Legend:

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

    r8765 r8779  
    18441844
    18451845    def test_change_password_request(self):
    1846         self.browser.open('http://localhost/app/sendpw')
     1846        self.browser.open('http://localhost/app/changepw')
    18471847        self.browser.getControl(name="form.identifier").value = '123'
    18481848        self.browser.getControl(name="form.email").value = 'aa@aa.ng'
     
    18871887        self.browser.open(self.edit_clearance_path)
    18881888        self.assertTrue('Employer' in self.browser.contents)
     1889
     1890class StudentRequestPWTests(StudentsFullSetup):
     1891    # Tests for student registration
     1892
     1893    layer = FunctionalLayer
     1894
     1895    def test_request_pw(self):
     1896        # Student with wrong reg_number can't be found.
     1897        self.browser.open('http://localhost/app/requestpw')
     1898        self.browser.getControl(name="form.firstname").value = 'Anna'
     1899        self.browser.getControl(name="form.reg_number").value = 'anynumber'
     1900        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
     1901        self.browser.getControl("Get login credentials").click()
     1902        self.assertTrue('No student record found.'
     1903            in self.browser.contents)
     1904        # Anonymous is not informed that firstname verification failed.
     1905        # It seems that the record doesn't exist.
     1906        self.browser.open('http://localhost/app/requestpw')
     1907        self.browser.getControl(name="form.firstname").value = 'Johnny'
     1908        self.browser.getControl(name="form.reg_number").value = '123'
     1909        self.browser.getControl(name="form.email").value = 'xx@yy.zz'
     1910        self.browser.getControl("Get login credentials").click()
     1911        self.assertTrue('No student record found.'
     1912            in self.browser.contents)
     1913        # Even with the correct firstname we can't register if a
     1914        # password has been set and used.
     1915        self.browser.getControl(name="form.firstname").value = 'Anna'
     1916        self.browser.getControl(name="form.reg_number").value = '123'
     1917        self.browser.getControl("Get login credentials").click()
     1918        self.assertTrue('Your password has already been set and used.'
     1919            in self.browser.contents)
     1920        self.browser.open('http://localhost/app/requestpw')
     1921        self.app['students'][self.student_id].password = None
     1922        # The firstname field, used for verification, is not case-sensitive.
     1923        self.browser.getControl(name="form.firstname").value = 'aNNa'
     1924        self.browser.getControl(name="form.reg_number").value = '123'
     1925        self.browser.getControl(name="form.email").value = 'new@yy.zz'
     1926        self.browser.getControl("Get login credentials").click()
     1927        # Yeah, we succeded ...
     1928        self.assertTrue('Your password request was successful.'
     1929            in self.browser.contents)
     1930        # ... and  student can be found in the catalog via the email address
     1931        cat = queryUtility(ICatalog, name='students_catalog')
     1932        results = list(
     1933            cat.searchResults(
     1934            email=('new@yy.zz', 'new@yy.zz')))
     1935        self.assertEqual(self.student,results[0])
     1936        return
Note: See TracChangeset for help on using the changeset viewer.