# Copyright (c) 2008-2009 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: CRMThreadRootList.bunit,v 1.8 2009/05/05 00:41:38 nagler Exp $ ListModel(); my($realm) = 'crm_tuple_forum'; req()->set_realm_and_user($realm, 'demo')->initialize_fully('FORUM_CRM_FORM'); my($now) = DateTime()->now; DateTime()->set_test_now(DateTime()->add_seconds($now, -60)); CRMThread()->test_unauth_delete_all({realm_id => req('auth_id')}); ShellUtil_TestCRM()->create_thread({ subject => my $subject = random_string(), 'b_ticket.TupleTag.slot1' => 'Male Puppy', 'b_ticket.TupleTag.slot2' => 'Medium', }); my($init_dt) = DateTime()->now; DateTime()->set_test_now($now); req()->set_user('crm_tech1'); ShellUtil_TestCRM()->update_thread({ action_id => realm_id('crm_tech2'), subject => $subject, }); my($mod_dt) = DateTime()->now; req()->set_realm($realm); foreach my $m (map(ureq($_), qw(Model.CRMThread Model.RealmMail))) { $m->delete_from_request if defined($m); } my($msg) = <<'EOF'; To: $to From: $from Subject: $subject Message-Id: $message_id $extra_headers body EOF DateTime()->set_test_now(DateTime()->add_seconds($now, -60)); Model_RealmMail()->create_from_rfc822(template(\(my $x = $msg), { to => email('crm_tuple_forum'), from => email('demo'), subject => my $subject2 = random_string(), message_id => '', extra_headers => '', })); my($email_init_dt) = DateTime()->now; DateTime()->set_test_now($now); my($subject3) = req('Model.RealmMail')->get('subject'); Model_RealmMail()->create_from_rfc822(template(\($x = $msg), { from => email('crm_tech1'), to => email('crm_tuple_forum'), subject => $subject3, message_id => '', extra_headers => '', })); my($email_mod_dt) = DateTime()->now; [ load_all => [ [] => [{ 'RealmMail.subject' => qr{$subject}, 'RealmFile.modified_date_time' => $init_dt, 'CRMThread.modified_date_time' => $mod_dt, modified_by_name => qr{crm_tech1}, owner_name => qr{crm_tech2}, 'RealmMail.from_email' => qr{demo}, }, { 'RealmMail.subject' => qr{$subject2}, 'RealmFile.modified_date_time' => $email_init_dt, 'CRMThread.modified_date_time' => $email_mod_dt, modified_by_name => qr{crm_tech1}, owner_name => undef, 'RealmMail.from_email' => qr{demo}, }], ], set_cursor_or_die => [ 0 => not_die(), ], get => [ 'b_ticket.TupleTag.Priority' => 'Medium', 'b_ticket.TupleTag.Product' => qr{DIE.*not found}, ], ];