Changeset 6590 for main/waeup.sirp/trunk


Ignore:
Timestamp:
10 Aug 2011, 22:03:44 (13 years ago)
Author:
Henrik Bettermann
Message:

Test assigning of local roles.

File:
1 edited

Legend:

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

    r6586 r6590  
    109109        app['applicants']['app2009'][self.pin_applicant] = self.applicant
    110110
    111         # Add an officer
    112         myusers = self.app['users']
    113         myusers.addUser('bob', 'bobssecret')
    114         return
    115 
    116111    def tearDown(self):
    117112        super(ApplicantsFullSetup, self).tearDown()
     
    156151        self.assertEqual(self.browser.headers['Status'], '200 Ok')
    157152        self.assertEqual(self.browser.url, self.manage_root_path)
     153        self.browser.getControl("Add local role").click()
     154        self.assertTrue(
     155            'No user selected' in self.browser.contents)
    158156        self.browser.open(self.manage_container_path)
    159157        self.assertEqual(self.browser.headers['Status'], '200 Ok')
     
    165163        self.assertTrue(
    166164            'No applicant selected' in self.browser.contents)
     165        self.browser.getControl("Add local role").click()
     166        self.assertTrue(
     167            'No user selected' in self.browser.contents)
    167168        self.browser.getControl("Cancel", index=0).click()
    168169        self.assertEqual(self.browser.url, self.container_path)
     170        # Managers can can assign local roles
     171        myusers = self.app['users']
     172        myusers.addUser('bob', 'bobssecret')
     173        self.browser.open(self.manage_root_path)
     174        self.browser.getControl(name="user").value = ['bob']
     175        self.browser.getControl(name="local_role").value = ['waeup.ApplicationsOfficer']
     176        self.browser.getControl("Add local role").click()
     177        self.assertTrue(
     178            '<td>bob</td>' in self.browser.contents)
     179        ctrl = self.browser.getControl(name='role_id')
     180        ctrl.getControl(value='bob|waeup.ApplicationsOfficer').selected = True
     181        self.browser.getControl("Remove selected local roles").click()
     182        self.assertTrue('Successfully removed:' in self.browser.contents)
     183        self.assertFalse(
     184            '<td>bob</td>' in self.browser.contents)
     185        self.browser.open(self.manage_container_path)
     186        self.browser.getControl(name="user").value = ['bob']
     187        self.browser.getControl(name="local_role").value = ['waeup.ApplicationsOfficer']
     188        self.browser.getControl("Add local role").click()
     189        self.assertTrue(
     190            '<td>bob</td>' in self.browser.contents)
     191        ctrl = self.browser.getControl(name='role_id')
     192        ctrl.getControl(value='bob|waeup.ApplicationsOfficer').selected = True
     193        self.browser.getControl("Remove selected local roles").click()
     194        self.assertTrue('Successfully removed:' in self.browser.contents)
     195        self.assertFalse(
     196            '<td>bob</td>' in self.browser.contents)
    169197        return
    170198
Note: See TracChangeset for help on using the changeset viewer.