# Copyright (c) 2011 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: RealmMail4.bunit,v 2.2 2011/03/14 19:17:04 nagler Exp $ Request(); req()->set_realm_and_user(qw(mail_references root)); my($ids) = sub { return [map(+{'RealmMail.message_id' => $_ . '@bivio.biz'}, @_)]; }; model('RealmMail')->do_iterate( sub { my($it) = @_; $it->update({ thread_root_id => $it->get('realm_file_id'), thread_parent_id => undef, }); return 1; }, ); [ [req()] => [ audit_threads => sub { my($threads) = model('MailThreadRootList')->map_iterate; assert_contains( $ids->(2, 1), $threads, ); assert_contains( $ids->(qw(2 2.1 2.2 2.1.1)), model('MailThreadList') ->map_iterate( sub {shift->get_shallow_copy}, {parent_id => $threads->[0]->{'RealmMail.realm_file_id'}}, ), ); return 1; }, ], ];