Example #1
0
    def test_add_rule_for_new_user(self):
        with session.begin():
            data_setup.create_user(user_name=u'marple')
        b = self.browser
        login(b, user=self.pool_owner.user_name, password='******')
        self.go_to_pool_edit()
        b.find_element_by_link_text('System Access Policy').click()

        # grant edit_policy permission to marple user
        pane = b.find_element_by_id('access-policy')
        pane.find_element_by_xpath('.//input[@placeholder="Username"]')\
            .send_keys('marple\n')
        find_policy_checkbox(b, 'marple', 'Edit this policy').click()
        check_policy_row_is_dirty(b, 'marple')
        pane.find_element_by_xpath('.//button[text()="Save changes"]').click()
        pane.find_element_by_xpath(
            './/span[@class="sync-status" and not(node())]')
        check_policy_row_is_not_dirty(b, 'marple')

        # refresh to check it has been persisted
        self.go_to_pool_edit()
        b.find_element_by_link_text('System Access Policy').click()
        self.assertTrue(
            find_policy_checkbox(b, 'marple',
                                 'Edit this policy').is_selected())
Example #2
0
    def test_add_rule(self):
        b = self.browser
        login(b, user=self.pool_owner.user_name, password='******')
        self.go_to_pool_edit()
        b.find_element_by_link_text('System Access Policy').click()

        # grant loan_any permission to anotherpoirot user
        pane = b.find_element_by_id('access-policy')
        checkbox = find_policy_checkbox(b, 'anotherpoirot', 'Loan to anyone')
        self.assertFalse(checkbox.is_selected())
        checkbox.click()
        check_policy_row_is_dirty(b, 'anotherpoirot')
        pane.find_element_by_xpath('.//button[text()="Save changes"]').click()
        pane.find_element_by_xpath('.//span[@class="sync-status" and not(node())]')
        check_policy_row_is_not_dirty(b, 'anotherpoirot')

        # refresh to check it is persisted
        self.go_to_pool_edit()
        b.find_element_by_link_text('System Access Policy').click()
        self.assertTrue(find_policy_checkbox(b, 'anotherpoirot', 'Loan to anyone').is_selected())
Example #3
0
    def test_add_rule(self):
        b = self.browser
        login(b, user=self.system_owner.user_name, password='******')
        b.get(get_server_base() + 'view/%s/' % self.system.fqdn)
        b.find_element_by_link_text('Access Policy').click()

        # grant loan_any permission to poirot user
        pane = b.find_element_by_id('access-policy')
        checkbox = find_policy_checkbox(b, 'poirot', 'Loan to anyone')
        self.assertFalse(checkbox.is_selected())
        checkbox.click()
        check_policy_row_is_dirty(b, 'poirot')
        pane.find_element_by_xpath('.//button[text()="Save changes"]').click()
        pane.find_element_by_xpath('.//span[@class="sync-status" and not(node())]')
        check_policy_row_is_not_dirty(b, 'poirot')

        # refresh to check it is persisted
        b.get(get_server_base() + 'view/%s/' % self.system.fqdn)
        b.find_element_by_link_text('Access Policy').click()
        self.assertTrue(find_policy_checkbox(b, 'poirot', 'Loan to anyone').is_selected())
Example #4
0
    def test_add_rule_for_new_user(self):
        with session.begin():
            data_setup.create_user(user_name=u'marple')
        b = self.browser
        login(b, user=self.pool_owner.user_name, password='******')
        self.go_to_pool_edit()
        b.find_element_by_link_text('System Access Policy').click()

        # grant edit_policy permission to marple user
        pane = b.find_element_by_id('access-policy')
        pane.find_element_by_xpath('.//input[@placeholder="Username"]')\
            .send_keys('marple\n')
        find_policy_checkbox(b, 'marple', 'Edit this policy').click()
        check_policy_row_is_dirty(b, 'marple')
        pane.find_element_by_xpath('.//button[text()="Save changes"]').click()
        pane.find_element_by_xpath('.//span[@class="sync-status" and not(node())]')
        check_policy_row_is_not_dirty(b, 'marple')

        # refresh to check it has been persisted
        self.go_to_pool_edit()
        b.find_element_by_link_text('System Access Policy').click()
        self.assertTrue(find_policy_checkbox(b, 'marple', 'Edit this policy').is_selected())