Changeset 5893 for main/waeup.sirp/trunk


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

Define path used in several tests in test-case setup.

File:
1 edited

Legend:

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

    r5892 r5893  
    4747        self.dc_root = tempfile.mkdtemp()
    4848        app['datacenter'].setStoragePath(self.dc_root)
     49        self.login_path = 'http://localhost/app/applicants/testapplicants/login'
    4950
    5051        # Add an applicants container where we can login (or not)
     
    6364    def test_anonymous_access(self):
    6465        # Anonymous users can access a login page
    65         path = 'http://localhost/app/applicants/testapplicants/login'
    66         self.browser.open(path)
     66        self.browser.open(self.login_path)
    6767        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    6868        return
     
    7070    def test_anonymous_invalid_creds(self):
    7171        # Anonymous users giving invalid credentials stay at the page
    72         path = 'http://localhost/app/applicants/testapplicants/login'
    73         self.browser.open(path)
     72        self.browser.open(self.login_path)
    7473        # We do not give credentials but send the form as-is
    7574        submit = self.browser.getControl(name='SUBMIT')
    7675        submit.click()
    7776        # We are still at the same page...
    78         self.assertEqual(
    79             self.browser.url,
    80             'http://localhost/app/applicants/testapplicants/login'
    81             )
     77        self.assertEqual(self.browser.url, self.login_path)
    8278        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    8379        return
     
    8581    def test_anonymous_invalid_creds_warning(self):
    8682        # Entering wrong credentials will yield a warning
    87         path = 'http://localhost/app/applicants/testapplicants/login'
    88         self.browser.open(path)
     83        self.browser.open(self.login_path)
    8984        # We do not give credentials but send the form as-is
    9085        submit = self.browser.getControl(name='SUBMIT')
     
    9691    def test_manager_no_warnings(self):
    9792        # Browsing the login screen as a manager, won't raise warnings
    98         path = 'http://localhost/app/applicants/testapplicants/login'
    9993        # Authenticate ourself as manager
    10094        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    101         self.browser.open(path)
     95        self.browser.open(self.login_path)
    10296        # Submit the form w/o any credentials
    10397        self.browser.getControl(name="SUBMIT").click()
     
    108102    def test_manager_no_redirect(self):
    109103        # Browsing the login screen as a manager won't trigger a redirect
    110         path = 'http://localhost/app/applicants/testapplicants/login'
    111104        # Authenticate ourself as manager
    112105        self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
    113         self.browser.open(path)
     106        self.browser.open(self.login_path)
    114107        # Submit the form w/o any credentials
    115108        self.browser.getControl(name="SUBMIT").click()
    116         self.assertEqual(
    117             self.browser.url,
    118             'http://localhost/app/applicants/testapplicants/login'
    119             )
     109        self.assertEqual(self.browser.url, self.login_path)
    120110        return
    121111       
Note: See TracChangeset for help on using the changeset viewer.