# Copyright (c) 2006 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: TupleSlotListForm.bunit,v 1.9 2009/05/01 17:11:20 nagler Exp $ my($tdid, $tn); FormModel({ setup_request => sub { my($case) = @_; req()->put(query => { parent_id => $tdid, $tn ? (this => $tn) : (), }); return; }, }); req()->set_realm_and_user(qw(fourem btest_read)); req()->initialize_fully('FORUM_TUPLE_EDIT'); $tdid = model(TupleUseList => {auth_id => req('auth_id')}) ->moniker_to_id('psr'); model('Tuple')->delete_all; [ [{ comment => 'hello1', slot_0 => 'a1@a.a', }] => [{ 'Model.TupleSlotListForm' => { slot_headers => "Author: a1\@a.a\nStatus: s1\n", 'RealmMail.from_email' => email('btest_read'), 'RealmMail.subject' => 'psr# - s1', }, 'Model.Tuple' => { tuple_num => sub {$tn = 1}, slot1 => 'a1@a.a', slot2 => 's1', }, 'Model.RealmMail' => { subject => sub { qr{psr#1 - s1}; }, }, }], empty_case({ slot_0 => 'a1@a.a', slot_1 => 's1', comment => undef, }), inline_case(sub {$tn = undef}), [{ slot_0 => 'a2@a.a', slot_1 => 's2', comment => 'comment one', }] => [{ 'Model.Tuple' => { tuple_num => sub {$tn = 2}, slot1 => 'a2@a.a', slot2 => 's2', }, 'Model.RealmMail' => { subject => qr{psr#2 - s2}, }, }], empty_case({ slot_0 => 'a2@a.a', slot_1 => 's2', comment => undef, }), [{ comment => 'hello3', slot_0 => 'a3@a.a', slot_1 => '', }] => [{ 'Model.TupleSlotListForm' => { slot_headers => "Author: a3\@a.a\nStatus: \n", 'RealmMail.from_email' => email('btest_read'), 'RealmMail.subject' => 'psr#2 - ', }, 'Model.Tuple' => { tuple_num => 2, slot1 => 'a3@a.a', slot2 => undef, }, 'Model.RealmMail' => { subject => 'psr#2 -', }, }], ];