Ignore:
Timestamp:
29 Mar 2011, 10:19:18 (14 years ago)
Author:
uli
Message:

Add more tests regarding invalid applicant credentials.

File:
1 edited

Legend:

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

    r5889 r5890  
    3636
    3737class LoginTest(FunctionalTestCase):
    38     # Here we check login functionality.
     38    # Here we check login view of applicants containers.
    3939   
    4040    layer = FunctionalLayer
     
    6868        return
    6969
     70    def test_anonymous_invalid_creds(self):
     71        # Anonymous users giving invalid credentials stay at the page
     72        path = 'http://localhost/app/applicants/testapplicants/login'
     73        self.browser.open(path)
     74        # We do not give credentials but send the form as-is
     75        submit = self.browser.getControl(name='SUBMIT')
     76        submit.click()
     77        # We are still at the same page...
     78        self.assertEqual(
     79            self.browser.url,
     80            'http://localhost/app/applicants/testapplicants/login'
     81            )
     82        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     83        return
     84
     85    def test_anonymous_invalid_creds_warning(self):
     86        # Entering wrong credentials will yield a warning
     87        path = 'http://localhost/app/applicants/testapplicants/login'
     88        self.browser.open(path)
     89        # We do not give credentials but send the form as-is
     90        submit = self.browser.getControl(name='SUBMIT')
     91        submit.click()
     92        self.assertTrue(
     93            'Entered credentials are invalid' in self.browser.contents)
     94        return
     95
    7096def suite():
    7197    suite = unittest.TestSuite()
Note: See TracChangeset for help on using the changeset viewer.