def test_remove_self_admin_group(self): with session.begin(): user = data_setup.create_admin(password='******') b = self.browser login(b, user=user.user_name, password='******') # admin should be in groups/mine b.get(get_server_base() + 'groups/mine') b.find_element_by_link_text('admin').click() # remove self b.find_element_by_xpath('//td/a[text()="Remove (-)" and ../preceding-sibling::td[2]/text()="%s"]' % user.user_name).click() # admin should not be in groups/mine b.get(get_server_base() + 'groups/mine') self.assertTrue(not is_text_present(b, 'admin')) logout(b) # login as admin login(b) group = Group.by_name('admin') group_users = group.users # remove all other users from 'admin' b.get(get_server_base() + 'groups/edit?group_id=1') for usr in group_users: if usr.user_id != 1: b.find_element_by_xpath('//td/a[text()="Remove (-)" and ../preceding-sibling::td[2]/text()="%s"]' % usr.user_name).click() # attempt to remove admin user b.find_element_by_xpath('//a[@href="removeUser?group_id=1&id=1"]').click() self.assert_('Cannot remove member' in b.find_element_by_class_name('flash').text)
def test_cannot_delete_protected_group_by_admin(self): with session.begin(): user = data_setup.create_admin(password='******') admin_group = Group.by_name('admin') b = self.browser login(b, user=user.user_name, password='******') b.get(get_server_base() + 'groups/') self.assert_('Delete' not in b.find_element_by_xpath( "//tr[(td[1]/a[text()='%s'])]" % admin_group.group_name).text) b.get(get_server_base() + 'groups/mine') self.assert_('Delete' not in b.find_element_by_xpath( "//tr[(td[1]/a[text()='%s'])]" % admin_group.group_name).text)
def test_cannot_delete_protected_group_by_admin(self): with session.begin(): user = data_setup.create_admin(password='******') admin_group = Group.by_name('admin') b = self.browser login(b, user=user.user_name, password='******') b.get(get_server_base() + 'groups/') self.assert_('Delete' not in b.find_element_by_xpath("//tr[(td[1]/a[text()='%s'])]" % admin_group.group_name).text) b.get(get_server_base() + 'groups/mine') self.assert_('Delete' not in b.find_element_by_xpath("//tr[(td[1]/a[text()='%s'])]" % admin_group.group_name).text)
def test_cannot_rename_protected_group(self): with session.begin(): admin_user = data_setup.create_admin(password='******') admin_group = Group.by_name(u'admin') b = self.browser login(b, user=admin_user.user_name, password='******') new_display_name = 'New Display Name for Group FBZ 2' new_group_name = 'FBZ-2-new' # edit b.get(get_server_base() + 'groups/edit?group_id=%d' % admin_group.group_id) self._edit_group_details(b, new_group_name, new_display_name) # check flash_text = b.find_element_by_class_name('flash').text self.assert_('Cannot rename protected group' in flash_text, flash_text)
def setUp(self): with session.begin(): self.user = data_setup.create_user(password=u'asdf') self.group = data_setup.create_group(owner=self.user) self.client_config = create_client_config(username=self.user.user_name, password=u'asdf') rand_user = data_setup.create_user(password=u'asdf') self.group.add_member(rand_user) self.rand_client_config = create_client_config(username=rand_user.user_name, password=u'asdf') admin = data_setup.create_admin(password=u'password') self.admin_client_config = create_client_config(username=admin.user_name, password=u'password') self.fake_ldap_group = data_setup.create_group( membership_type=GroupMembershipType.ldap)
def test_remove_self_admin_group(self): with session.begin(): user = data_setup.create_admin(password='******') b = self.browser login(b, user=user.user_name, password='******') # admin should be in groups/mine b.get(get_server_base() + 'groups/mine') b.find_element_by_link_text('admin').click() # remove self b.find_element_by_xpath('//td[preceding-sibling::td[2]/text()="%s"]' % user.user_name)\ .find_element_by_link_text('Remove').click() self.assertEquals( b.find_element_by_class_name('flash').text, '%s Removed' % user.user_name) # admin should not be in groups/mine b.get(get_server_base() + 'groups/mine') check_group_search_results(b, absent=[Group.by_name(u'admin')]) logout(b) # login as admin login(b) group = Group.by_name('admin') group_users = group.users # remove all other users from 'admin' b.get(get_server_base() + 'groups/edit?group_id=1') for usr in group_users: if usr.user_id != 1: b.find_element_by_xpath('//td[preceding-sibling::td[2]/text()="%s"]' % usr.user_name)\ .find_element_by_link_text('Remove').click() self.assertEquals( b.find_element_by_class_name('flash').text, '%s Removed' % usr.user_name) # attempt to remove admin user b.find_element_by_xpath( '//a[@href="removeUser?group_id=1&id=1"]').click() self.assert_('Cannot remove member' in b.find_element_by_class_name( 'flash').text)
def setUp(self): with session.begin(): self.user = data_setup.create_user(password = '******') self.group = data_setup.create_group(owner=self.user) self.client_config = create_client_config(username=self.user.user_name, password='******') rand_user = data_setup.create_user(password = '******') rand_user.groups.append(self.group) self.rand_client_config = create_client_config(username=rand_user.user_name, password='******') admin = data_setup.create_admin(password='******') self.admin_client_config = create_client_config(username=admin.user_name, password='******') self.fake_ldap_group = data_setup.create_group(ldap=True) self.mail_capture = mail_capture.MailCaptureThread() self.mail_capture.start()
def setUp(self): with session.begin(): self.user = data_setup.create_user(password='******') self.group = data_setup.create_group(owner=self.user) self.client_config = create_client_config( username=self.user.user_name, password='******') rand_user = data_setup.create_user(password='******') rand_user.groups.append(self.group) self.rand_client_config = create_client_config( username=rand_user.user_name, password='******') admin = data_setup.create_admin(password='******') self.admin_client_config = create_client_config( username=admin.user_name, password='******') self.fake_ldap_group = data_setup.create_group(ldap=True) self.mail_capture = mail_capture.MailCaptureThread() self.mail_capture.start() self.addCleanup(self.mail_capture.stop)
def setUp(self): self.admin_password = '******' with session.begin(): self.admin_user = data_setup.create_admin(password=self.admin_password) self.s = requests.Session()
def setUp(self): self.admin_password = '******' with session.begin(): self.admin_user = data_setup.create_admin( password=self.admin_password) self.s = requests.Session()