# Copyright (c) 2008 bivio Software, Inc. All Rights Reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: GroupUserForm2.bunit,v 1.2 2010/03/03 23:49:13 nagler Exp $ FormModel({ check_return => sub { my($case, undef, $expect) = @_; return 1 unless shift->is_method('process'); if (ref($expect->[0])) { assert_equals( $expect->[0]->{class()}, $case->get('object')->get_errors, ); return 1; } model('GroupUserList')->execute_load_this; assert_equals( $expect, [map($_->get_name, @{req(qw(Model.GroupUserList roles))})], ); return 1; }, }); [ req_state({ task => 'GROUP_USER_FORM', user => 'root', realm => 'fourem', query => {this => realm_id('root')}, }), [{ 'RealmUser.role' => Auth_Role('ADMINISTRATOR'), file_writer => 1, mail_recipient => 0, }] => [qw(ADMINISTRATOR FILE_WRITER)], [{ 'RealmUser.role' => Auth_Role('MEMBER'), file_writer => 1, mail_recipient => 0, }] => [qw(MEMBER FILE_WRITER)], error_case({ 'RealmUser.role' => Auth_Role('ADMINISTRATOR'), file_writer => 1, mail_recipient => 0, } => { 'RealmUser.role' => 'NOT_FOUND', }), inline_rollback(), [{ 'RealmUser.role' => Auth_Role('ADMINISTRATOR'), file_writer => 1, mail_recipient => 0, }] => [qw(ADMINISTRATOR FILE_WRITER)], [{ 'RealmUser.role' => Auth_Role('ADMINISTRATOR'), file_writer => 0, mail_recipient => 1, }] => [qw(ADMINISTRATOR FILE_WRITER MAIL_RECIPIENT)], ];