def test_ok(self): # add another user so that we can be sure we are not deleting the # user the Client is currently logged in as, which would cause a 302 user_id = create_user_with_permissions().id # add a group so we get 200s when working with it instead of 302s group_id = Group.add(name=u'TestUsersManage.test_ok-group').id # get a list of permissions (there should be at least one) so we have a real id permission_id = Permission.pairs('id:name', Permission.name)[0][0] routes = ( '/users/add', '/users/login', '/users/recover-password', '/users/change-password', '/users/edit/%s' % user_id, '/users/manage', '/users/permissions/%s' % user_id, '/groups/add', '/groups/edit/%s' % group_id, '/groups/manage', '/permissions/manage', '/permissions/edit/%s' % permission_id, ) for route in routes: yield self.check_code, 200, route routes = ( '/users/delete/%s' % user_id, '/groups/delete/%s' % group_id, ) for route in routes: yield self.check_code, 302, route
def add_user_permissions_section(self): hel = self.add_header('user_permissions_header', 'User Permissions') perm_opts = orm_Permission.pairs('id:name', orm_Permission.name) gel = self.add_mselect('approved_permissions', perm_opts, 'Approved', choose=None) gel = self.add_mselect('denied_permissions', perm_opts, 'Denied', choose=None) return hel, gel
def add_group_permissions_section(self): self.add_header('group_permissions_header', 'Group Permissions') perm_opts = orm_Permission.pairs('id:name', orm_Permission.name) self.add_mselect('approved_permissions', perm_opts, 'Approved', choose=None) self.add_mselect('denied_permissions', perm_opts, 'Denied', choose=None)