# 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: User.bunit,v 1.7 2008/05/04 21:56:37 david Exp $ Request(); my($prefix) = 'user_bunit_'; shell_util('TestRealm', [delete_by_regexp => "^$prefix"]); sub _name {$prefix . shift} [ [req()] => [ create_realm => [ [{first_name => 'User 1'}, {name => _name(1)}] => not_die(), [{first_name => 'User 2'}, {name => _name(2)}] => not_die(), ], ], sub {model('RealmOwner')} => [ unauth_delete_realm => [ [{name => _name(1)}] => not_die(), ], unauth_load_or_die => [ [{name => _name(2)}] => not_die(), ], ], sub {req()->set_realm(_name(2)); model('User')} => [ load => [ [] => not_die(), ], update => [ [{first_name => 'User X'}] => not_die(), ], ], sub {model('RealmOwner')} => [ load => [ [] => not_die(), ], get => [ ['display_name'] => 'User X', ], ], sub {model('User')} => [ delete => [ [] => DIE(), ], ], ];