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())
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())
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())
def test_remove_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() # revoke loan_self permission from sidekicks group pane = b.find_element_by_id('access-policy') checkbox = find_policy_checkbox(b, 'sidekicks', 'Loan to self') self.assertTrue(checkbox.is_selected()) checkbox.click() check_policy_row_is_dirty(b, 'sidekicks') pane.find_element_by_xpath('.//button[text()="Save changes"]').click() pane.find_element_by_xpath('.//span[@class="sync-status" and not(node())]') # "sidekicks" row is completely absent now due to having no permissions check_policy_row_is_absent(b, 'sidekicks') # 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() pane = b.find_element_by_id('access-policy') self.assertNotIn('sidekicks', pane.text)
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())