Changeset 5985 for main/waeup.sirp


Ignore:
Timestamp:
26 Apr 2011, 11:21:32 (14 years ago)
Author:
uli
Message:

Add test for applicant trying invalid anonymous login.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.sirp/trunk/src/waeup/sirp/applicants/tests/test_browser.py

    r5912 r5985  
    150150
    151151    def test_anonymous_valid_login(self):
     152        # If we enter valid credentials, we get to the applicants form
    152153        self.browser.open(self.login_path)
    153154        # Enter some value we can look for after submit
     
    159160        # We should be redirected to applicants form.
    160161        self.assertTrue(self.browser.url != self.login_path)
     162        return
     163
     164    def test_anonymous_invalid_login(self):
     165        # If we enter wrong credentials we won't get far
     166        self.browser.open(self.login_path)
     167        # Enter some value we can look for after submit
     168        ac_series = self.browser.getControl(name="form.ac_series")
     169        ac_series.value = 'illegal series'
     170        ac_number = self.browser.getControl(name="form.ac_number")
     171        ac_number.value = 'invalid number'
     172        self.browser.getControl(name="SUBMIT").click()
     173        # We get a warning message
     174        self.assertTrue(
     175            'Entered credentials are invalid' in self.browser.contents)
     176        # We stay at the login page (no redirect)
     177        self.assertTrue(self.browser.url == self.login_path)
    161178        return
    162179
Note: See TracChangeset for help on using the changeset viewer.